CPSC 231: Assignment 3 (Worth 1%)
Grade out of 11 |
Letter |
11 |
A |
10 |
A- |
9 |
B+ |
8 |
B |
7 |
B- |
6 |
C+ |
5 |
C |
4 |
C- |
3 |
D+ |
2 |
D |
1 |
D- |
0 |
F |
Part 1: Fixing a broken program (5 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 Unix file to "fixed.p",
and the name of the program to "fixed". After this fix the
four syntax errors in the program so
that it will compile. Aside from making the minimal amount of 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).
Five 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
syntax errors by interpreting the error messages given by the compiler.
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
"converter.p". You are to change this program so that the output matches
the output of the executable program called "converter".
What you need to do:
-
Modify the program so that it displays
only one digit for the decimal value of the converted temperatures. (2 marks)
-
Make the semi-colons line up vertically
(for the two lines "Celsius value" and "Fahrenheit value") by setting the field width.
(2 marks)
-
Make the decimal places for the converted temperatures line up by setting
the field width. (2 marks)
In terms of setting up the text formatting
you can assume that the temperatures will only range from -573.28 C / -999.9 F
to 537.72 C / 999.9 F.
New concepts to be applied:
Producing simple formatted output in Pascal.
Submission requirements
In addition to having fulfill the generic
assignment requirements, the requirements specific to this assignment include:
1. Assignments (source code/'dot'-p file and REAMDE) must be electronically submitted via
submit. In addition, paper print outs of
the source code and README must be handed into the assignment drop box for the tutorial
that you are registered in (located on the second floor of the Math Sciences
building). 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. The README file should indicate which of the
above features have been completed.