1. The interest rate used on funds deposited in a bank is determined by the amount of time the money is left on deposit. For a particular bank, the following schedule is used:
Time on deposit
Interest rate
Greater than or equal to 5 years
0.0475
Less than 5 years but greater than or equal to 4 years
0.045
Less than 4 years but greater than or equal to 3 years
0.040
Less than 3 years but greater than or equal to 2 years
0.035
Less than 2 years but greater than or equal to 1 year
0.030
Less than 1 year
0.025
Since the question was incomplete, my answer calculates the rate, interest and amount.
#include <iostream>
using namespace std;
int main() {
double principal, rate, time; // variable declaration
// take input
cout << "Enter principal: ";
cin >> principal;
cout << "Enter time: ";
cin >> time;
if(time >= 5) // Greater than or equal to 5 years
rate = 0.0475;
else if(time < 5 && time >= 4) // Less than 5 years but greater than or equal to 4 years
rate = 0.045;
else if(time < 4 && time >= 3) // Less than 4 years but greater than or equal to 3 years
rate = 0.040;
else if(time < 3 && time >= 2) // Less than 3 years but greater than or equal to 2 years
rate = 0.035;
else if(time < 2 && time >= 1) // Less than 2 years but greater than or equal to 1 year
rate = 0.030;
else // Less than 1 year
rate = 0.025;
cout << "The rate for " << time << " year(s) is " << rate << endl;
double interest = principal * rate * time; // calculate interest (SI = P * R * T)
double amount = principal + interest; // calculate amount
cout << "The interest is " << interest << endl;
cout << "The amount is " << amount << endl;
return 0;
}
Comments
this is great, good work done champ
Leave a comment