, Assignment 2 2023
DUE DATE: 3 July 2023
CUT-OFF DATE: 6 July 2023
TUTORIAL MATTER: Chapters 4, 5, 6, 8 and 9 of the Study Guide
Chapters 4 (section 4.6), 5 (section 5.5), 6, 8 and 9
(excluding the optional parts of section 9.2) of
Savitch
WEIGHT: 30%
MARKS: 70
Question 1
Write a program to determine the tuition fees for a student. The program should use
two overloaded functions, each named calcFees, to determine the tuition fees for a
student. Students who repeat a module pay a different fee for the modules which are
repeated. The program should first ask if the student repeats any modules. If the
student repeats, the program should ask for the number of modules which are
repeated.
One of the overloaded functions should accept the number of modules enrolled for the
first time and the fee for those modules as arguments (parameters), while the other
function accepts arguments for the number of modules enrolled for the first time and
the fee for those modules as well as the number of modules repeated and the fee for
those modules. Both functions should return the tuition fees for the student.
Question 2
Write a program that converts from 24-hour notation to 12-hour notation. For example,
it should convert 14:25 to 2:25 PM. The input is given as two integers. Verifies that a
legitimate 24-hour notation has been input by using the assert statement.
Question 3
Write a program for your local bank to prepare a statement for a customer’s checking
account at the end of each month. The data is stored in a .dat file in the following
format:
, 46780976 3750.40
W 250.00
D 1200.00
W 75.00
W 375.00
D 1200.00
I 5.50
W 400.00
W 600.00
D 450.50
W 35.65
The first line of code shows the account number followed by the account balance. For
each line of code there is a transaction code and the transaction amount. The
transaction codes are as follows:
W = Withdrawal
D = Deposit
I = Interests
The program has to display the account statement on the console. It should update
the balance after each transaction. During the month, if at any time the balance goes
below R 1000, a R25 service fee is charged. The program should print the following
information: account number, opening balance at the beginning of the month, each
transaction as it occurs, service fees when charged, interest paid by the bank and
closing balance at the end of the month. Banking costs (i.e. total of all service fees
incurred) are deducted at the end of the month. An example of the output your program
should produce for the input file above, is shown below. Note that a deposit is shown
as a credit (‘Ct’) on the statement:
Sample output:
Account number: 46780976
Opening balance: R3750.40
Transaction Amount Balance Bank costs
Withdrawal 250.00 4000.00
Deposit 1200.00Ct 2800.00
Withdrawal 75.00 2725.00
Withdrawal 1375.00 1350.00
Deposit 1200.00Ct 1550.00
Interest 5.50 1555.50
Withdrawal 400.00 1155.50
Withdrawal 600.00 555.50 25.00
Deposit 450.00Ct 1005.50
Withdrawal 35.65 969.85
Banking costs 25.00 969.60
Closing balance: R969.60