Question

If money is left in a particular bank for more than 5 years, the interest rate...

If money is left in a particular bank for more than 5 years, the interest rate given by the bank is 7.5%, else the interest rate is 5.4%. Write a program that prompt the user for the number of years that the money was left in the bank and display the appropriate interest rate depending on the value input. How many runs should you make to very that it works correctly?

Homework Answers

Answer #1

I have run the code in c++ language.

#include <iostream>

using namespace std;

int main()
{
    int years;
    //prompts user to enter no of years
    cout<<"Enter number of years that the money was left in the bank: ";
    cin>>years;
    
    //checks if years is greater than 5 then interest rate is 7.5%
    if(years >5 ){
        cout<<"Interest rate given by the bank is 7.5%";
    }
    
    //if years is less than 5 then it goes in else loop and interest rate is 7.5%
    else{
        cout<<"Interest rate given by the bank is 5.4%";
    }

    return 0;
}

I have run the program two times to very that it works correctly. one for entering number of years less than 5 and another for wntering number of years greater than 5.


1 . Output of entering number of years greater than 5 is as below.

2 . Output of entering number of years less than 5 is as below.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Mr. Mike wants to calculate a monthly mortgage payment. Assume that the interest rate is compounded...
Mr. Mike wants to calculate a monthly mortgage payment. Assume that the interest rate is compounded monthly. Prompt the user for a double representing the annual interest rate. Prompt the user for the number of years the mortgage will be held. ( typical input here is 10,15 or 30) Prompt the user for a number representing the mortgage amount borrowed from the bank. Write a Java Program that calculates the monthly mortgage payment. Output the summary of the mortgage problem...
Write a program that calculates and displays the amount of money available in a bank account...
Write a program that calculates and displays the amount of money available in a bank account that initially has $8000 deposited in it and that earns interest at the rate of 3.5 percent a year. Your program should display the amount available at the end of each year for a period of 7 years. Use the relationship that the money available at the end of each year equals the amount of money in the account at the start of the...
USE MATLAB The lump sum S to be paid when interest on a loan is compounded...
USE MATLAB The lump sum S to be paid when interest on a loan is compounded annually is given by where is the principal invested, is the interest rate, and is the number of years. Write a modular program that will plot the amount S as it increases through the years from 1 to n. The main script lumpsum.m will call a function inputyears.m to prompt the user for the number of years (and error-check to make sure that the...
You are currently investing your money in a bank account that has a nominal annual rate...
You are currently investing your money in a bank account that has a nominal annual rate of 3.5 percent, compounded monthly. How many years will it take for you to double your money? Please keep two decimal places and make sure you round up/down correctly to two decimal places.
How much money do you think you would earn in a period of 30 days if...
How much money do you think you would earn in a period of 30 days if you were paid as follows: one cent for the first day, two cents for the second day, four cents for the third day, eight cents for the fourth day, and so on (i.e. your salary doubles each day)? Do you think you would make very little money, just a few dollars, at the end of the 30-day period? Let us write a program to...
Assume that 5 years from now you will need RM2000. Your bank compounds interest at a...
Assume that 5 years from now you will need RM2000. Your bank compounds interest at a 6% annual rate. b. If you want to make equal payments at the end of Years 1 through 5 to accumulate the RM2,000, how large must each of the 5 payments be? c. If your father were to offer either to make the payments calculated in part (b) or to give you a lump sum of RM1,050 one year from now, which would you...
How much money would you have in a year if you put $1,000 in the bank...
How much money would you have in a year if you put $1,000 in the bank at an annual interest rate of 3 percent? How much would you have if you left all of that money in the bank for another year and annual interest rates increased to 4 percent in the second year? How much would you loan your brother-in-law if he said he could repay you $100 in six months, $200 in a year, and $500 in two...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...
1.What is the discount rate assuming the present value of $840 at the end of 1-year...
1.What is the discount rate assuming the present value of $840 at the end of 1-year is $765? 2.What is the Future value of $3,500 deposited for 12 years at 5% compounded annually? 3. If $2,800 is discounted back 4 years at an interest rate of 8% compounded semi-annually, what would be the present value? 4. Determine the future value of $6,000 after 5 years if the appropriate interest rate is 8%, compounded monthly. 5. Consider a newlywed who is...
Use a few sentences to describe the problem given below . Also, Identify the nouns and...
Use a few sentences to describe the problem given below . Also, Identify the nouns and verbs used in the below project descriptions.  Identified nouns, list the ones that are necessary to define variables in your program. For each variable, specify its name, data type, and what information it is used to store. Write the pseudo code algorithm (i.e. algorithm steps) to solve this problem. (For the base salaries and commission rates use constants instead to keep these values. Use the...