CPSC 231: Assignment 6 (Worth 5%)
Grading Scales
Grade out of 28 |
Letter |
27 - 28 |
A+ |
25 - 26 |
A |
23 - 24 |
A- |
20 - 22 |
B+ |
17 - 19 |
B |
14 - 16 |
B- |
11 - 13 |
C+ |
8 - 10 |
C |
6 - 7 |
C- |
4 - 5 |
D+ |
3 |
D |
2 |
D- |
0 or 1 |
F |
New concepts to be applied for this assignment
Assignment description
For this assignment you are to write a simple calculator. The program
will prompt the user to enter mathematical expression and program will
display the original expression as well as the result. It will then prompt the
person if they wish to run the program again. The expression will be
entered in the following format:
<First operand> <Operation>
<Second operand>
- Operands will consist of a one or two digit number.
- Operations will consist of: addition (+), subtraction (-),
multiplication (*) or integer division (/).
- There is no spaces in the expression.
Pascal functions and procedures that you can use:
For this assignment cannot use any pre-created functions or procedures that
convert character arrays to integers. You can however use the 'ord'
function to determine the ASCII value for a given character.
Grading
(Bare bones) basic assignment (worth 5 marks)
- Declares a one-dimensional character array to store the expression
- Displays an introduction
- Prompts the user to enter a mathematical expression
- Reads the expression into the array
- Displays the expression onscreen
- Loops back to third step until the person quits the program
- Displays a sign off exit message
One mark will be lost for each of the above features that are missing down to
a minimum grade of 3 (assuming that the program compiles).
Extra features:
Once you complete all the features of the
basic assignment you can complete the extra features for additional credit (make
sure you backup your work first!) Unless there are technical
considerations you can complete
these extra features in whatever order or combination that you desire.
(For example: Your program can't perform a mathematical until it can extract the
necessary information from the array).
- Extract the first operand from the array and display it onscreen
(maximum of 4 marks)
|
|
Single digit can be extracted:
3 marks |
|
Multiple digits can be
extracted: 4 marks |
- Extract the operator from the array and display it onscreen:
1 mark
|
- Extract the second operand from
the array and display it onscreen (maximum of 4 marks)
|
|
Single digit can be extracted:
3 marks |
|
Multiple digits can be
extracted: 4 marks |
- Check if the operator is valid
('+', '-', '*' or '/'): 1 mark
|
- Check if the first operand is
valid: 1 mark
|
- Check if the second operand is
valid: 1 mark
|
- Can convert the operand from a
character string to an integer (maximum of 4 marks)
|
|
Single digit operand can be
converted: 1 mark |
|
Multiple digit operand can be
converted: 4 marks |
- Program can perform the
mathematical operation (maximum of 7 marks)
|
|
Operations can be performed on
single digit operands only: 3 marks |
|
Operations can be performed on
two digit operands only: 5 marks |
|
Operations can be performed on
one or two digit operands: 7 marks |
Submission requirements
In addition to having fulfill the generic
assignment requirements, the requirements specific to this assignment include:
-
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 that you implemented.
-
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".
-
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 'calculator' can be found in
UNIX under the directory: /home/231/tamj/assignments/assignment6.