CPSC 231: Assignment 3 (Worth 1%) Due Wednesday May 26
Grade out of 10 |
Letter |
10 |
A |
9 |
A- |
8 |
B+ |
7 |
B |
6 |
B- |
5 |
C+ |
4 |
C |
3 |
C- |
2 |
D+ |
1 |
D |
0 |
F |
Part 1: Fixing a broken program (4 marks)
In the assignment 3 directory (under
/home/231/assignments/assignment3) you will find a Pascal program in a Unix
text file called "broken.p". Rename the name of the Unix file to "fixed.p"
and name program "fixed". What you have to do is to fix the three syntax errors in the program so
that it will compile. Aside from making changes that will allow the program
to compile you cannot otherwise change the program (i.e., you can't just
simply write your own Pascal program instead of using the one that was
provided).
Four marks will be given only for a program
that will compile and is properly renamed. A mark will be lost if the
program compiles but is not properly named. Only one mark will be
given for a program that is properly named but does not compile (partial
credit for fixing only some of the syntax errors will not be given
because it is crucial that you learn early on how to spot and correct this
type of error).
New concepts to be applied:
Getting familiar with some of the more
common syntax errors that prevent program your program from compiling. The
ultimate goal is to be able to produce a program free of these errors.
Part 2: Simple text formatting (6 marks)
In the assignment 3 directory (under
/home/231/assignments/assignment3) you will find a Pascal program called
"simpleInterest.p". You are to change this program so that the output matches
the output of the executable program called "simpleInterest".
What you need to do:
-
Modify the program so that it displays
only two places of precision for the currency values. (2 marks)
-
Make the dollar signs for the principle
and the amount line up one on top of the other by setting the field width.
(2 marks)
- Make the decimal places for the principle and the amount line up one on
top of the other by setting the field width. (2 marks)
In terms of setting up the text formatting
you can assume that the largest number that will be displayed is $99,999.99.
New concepts to be applied:
Producing simple formatted output in Pascal.
Method of submission
Hand in a typescript of your completed assignment, this is step #3 of the
assignment submission guidelines.