Weighting = 3% (1% for each program). Executable solutions to the assignment and any applicable text-only versions of the programs can be found in Unix under /home/231/assignments/assignment3. The names of the executables are: "fixed", "simpleInterest" and "incomeStatements". All three parts of the assignment must be completed on the Computer Science computers. You must hand in your submission via a printed typescript.
The following program has a number of syntax errors that prevent it from being compiled into an executable "a.out". Copy the text version of this program to your home directory. Rename the program to "fixed.p" and fix all of the syntax errors. Run the typescript (as described in the general assignment specifications), display the program, compile and run it within the script to show that it works.
program fixed (input, output)
var
x, y: integer
begin
x = 5;
y = x * 2;
writeln('Value of x = , x, ' Value of y = ', y);
end.
Loans that accrue simple interest are ones in which the interest is accumulated only on the original amount borrowed (the principle) and not on the interest that is accumulated. The following formula is used for calculating simple interest:
interest = principle * interest rate * time
For example, suppose that someone borrows $100.00 for 7 years at 12% interest per year. The amount of interest that will be owing after seven years have elapsed would be calculated by plugging in these values into the above formula: