|
|
|
|
|
|
|
4. Write a top-down design and a C++ program with functions to help you balance your checking account. The program should let you enter the initial balance for the month, followed by a series of transactions. For each transaction entered, the program should echo-print the transaction data, the current balance for the account, and the total service charges. Service charges are $0.10 for a deposit and $0.15 for a check. If the balance drops below $500.00 at any point during the month, a service charge of $5.00 is assessed for the month. If the balance drops below $50.00, the program should print a warning message. If the balance becomes negative, an additional service charge of $10.00 should be assessed for each check until the balance becomes positive again. |
|
|
|
|
|
|
|
|
A transaction takes the form of a letter, followed by a blank and a float number. If the letter is a C, then the number is the amount of a check. If the letter is a D, then the number is the amount of a deposit. The last transaction consists of the letter E, with no number following it. A sample run might look like this: |
|
|
|
 |
|
|
|
|
Enter the beginning balance: 879.46 Enter a transaction: C 400.00 Transaction: Check in amount of $400.00
Current balance: $479.46
Service charge: Check - $0.15
Service charge: Below $500 - $5.00
Total service charges: $5.15
Enter a transaction: D 100.0 Transaction: Deposit in amount of $100.00
Current balance: $579.46
Service charge: Deposit - $0.10
Total service charges: $5.25
Enter a transaction: E Transaction: End
Current balance: $579.46
Total service charges: $5.25
Final balance: $574.21 |
|
|
|
|
|
|
|
|
As usual, your program should use proper style and indentation, meaningful identifiers, and appropriate comments. Also, be sure to check for data errors such as invalid transaction codes or negative amounts. |
|
|
|
|
|
|
|
|
5. In this problem you are to design and implement a Roman numeral calculator. The subtractive Roman numeral notation commonly in use today (such as IV, meaning "4") was used only rarely during the time of the Roman Republic and Empire. For ease of calculation, the Romans most frequently used a purely additive notation in which a number was simply the sum of its digits (4 equals IIII, in this notation). Each number starts with the digit of highest value and ends with the digit of smallest value. This is the notation we use in this problem. |
|
|
|
|
|