COS1512 Assignment 2 2023 (DUE : 6 July 2023). 100% CORRECT questions, answers, workings and explanations. for assistance. 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 f...
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
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller LOVELY01. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R48,67. You're not tied to anything after your purchase.