Programming Fundamental Assignment 2
Programming Fundamental Assignment 2
Assignment no 2
Program no 12
A bank in your town updates its customers accounts at the end of each month. The bank offers two
types of accounts: savings and checking. Every customer must maintain a minimum balance, If a
customer’s balance fall below the minimum balance, there is a service charge of $10.00 for savings
accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the
minimum balance, the account receives interest as follows
B. Checking accounts with balances of up to $5,000 more than the minimum balance receive 3% interest;
otherwise, the interest is 5%
Solution:
#include <iostream>
int main()
Double service charge = (account type == ‘S’ || account type == ‘s’) ? (balance < mini balance ? 10.0 :
0.0) : (balance < mini balance ? 25.0 : 0.0);
Double interest = (account type == ‘S’ || account type == ‘s’) ? (balance < mini balance ? 0.0 : balance *
0.04) : (balance < mini balance ? 0.0 : (balance – mini balance <= 5000.0 ? (balance – mini balance) *
0.03 : 5000.0 * 0.03 + (balance – mini balance – 5000.0) * 0.05));
cout << “Service Charge: $” << service charge << “\n Interest Earned: $” << interest << “\n New Balance:
$” << new balance <<endl;
return 0;
}
Program no 13
Write a program that implements the algorithm given in Example 1-3 (Chapter 1), which determines the
monthly wages of a salesperson
Solution:
#include <iostream>
int main()
Return 0;