Introduction to Computer Science I by James Tam Return to the course web page

CPSC 231: Assignment 6 (Worth 5%)

Grading Scales

Grade out of 24 Letter
53 - 54 A+
51 - 52 A
48 - 50 A-
44 - 47 B+
40 - 43 B
36 - 39 B-
32 - 35 C+
28 - 31 C
24 - 27 C-
18 - 23 D+
12 - 17 D
6 - 11 D-
0 - 5 F

 

New Concepts to be applied for the assignment

  1. One-dimensional arrays
  2. Text analysis

 

Performing simple text analysis

For this assignment you are to write a program that will prompt the user to enter a sentence. The end of the sentence will be marked with a period '.' (your program doesn't have to deal with other forms of punctuation). Sentences will range from 0 characters in length i.e., the user just enters a period '.' up to 79 characters (with the 80th character being a period). The program will then display the sentence that was entered and an analysis of the input: the number of characters entered (up to and excluding the period) and the number of words. Words will be separated with a single space with the last word ending in a period.

Features to be implemented
 
  1. Shows instructions for what the user is supposed to do and describe what the program is supposed to do: 1 mark
 
  1. Prompt the user to enter a sentence: 1 mark
 
  1. Read the sentence into a one-dimensional character array: 1 mark
 
  1. Display the sentence that was entered: 2 marks
 
  1. Count and display onscreen the number of characters in the sentence: 11 marks
 
  1. Count and display onscreen the number of words in the sentence: 11 marks
 
  1. Program can handle the case of an empty sentence (i.e., when the user only enters a period the program indicates that no characters and no words were entered). In order to get credit for this feature you need to have implemented Feature #5 or Feature #6 (or both): 5 marks

 

Submission requirements

In addition to having fulfill the generic assignment requirements, the requirements specific to this assignment include:

  1. Include a README file in your submission:  For this assignment your README file must include your contact information: your name, university identification number and UNIX login name so that your marker knows whose assignment that he or she is marking.   For this assignment you should also list the features of the game that you actually implemented.

  2. Assignments (source code/'dot-p' file and the README file) must be electronically submitted.  In addition a paper print out of the source code and README must be handed into the assignment drop box (located on the second floor of the Math Sciences building) for the tutorial that you are registered in.  Electronically submitting the assignment allows your marker to run the code in order to quickly determine what features were implemented.  Providing a paper printout makes it easier for your marker to read and flip through your source code.  Unless you are told otherwise you are to email your source code and readme file to your TA and to me.  Make sure that include the following information in the subject line: "CPSC 231 Assignment X" where 'X' stands for the assignment number that you are submitting e.g., "CPSC 231 Assignment 3".

  3. As a reminder, you are not allowed to work in groups for this class.   Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following link.

To help make sure that you haven't missed anything here is a checklist of items to be used in marking.  A sample executable 'analyzer' can be found in UNIX under the directory: /home/231/tamj/assignments/assignment6.