Answer to Question #127513 in C++ for Bic Cana

Question #127513

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



1
Expert's answer
2020-07-28T10:01:46-0400

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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Godswill Affisah
08.08.20, 17:30

this is great, good work done champ

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS