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
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...
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...
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...
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...
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
a. Define the class bankAccount to store a bank customer’s account number and balance. Suppose that...
a. Define the class bankAccount to store a bank customer’s account number and balance. Suppose that account number is of type int, and balance is of type double. Your class should, at least, provide the following operations: set the account number, retrieve the account number, retrieve the balance, deposit and withdraw money, and print account information. Add appropriate constructors. b. Every bank offers a checking account. Derive the class checkingAccount from the class bankAccount (designed in part (a)). This class...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number of servings that are really possible with the included ingredients. Sometimes one will want to be able to scale those recipes upwards for serving larger groups. This program's task is to determine how much of each ingredient in a recipe will be required for a target party size. The first inputs to the program will be the recipe itself. Here is an example recipe...