Question

In: Computer Science

User asks you to develop a program that calculates and then prints interest earned on a...

User asks you to develop a program that calculates and then prints interest earned on a bank balance. Program should print interest earned for the same balance when interest is accumulated annually, semiannually and quarterly. I need the C++ code!

Solutions

Expert Solution

C++ program Code for the given problem is provided below, please comment if any doubts:

#include <iostream>

using namespace std;

int main()
{
   //declare the variables
   float In, ra, Amt, yr;

   //Read the amount
   cout<<"Enter the amount balance: ";
   cin>>Amt;

   //Read annual interest rate
   cout<<"Enter the annual interest rate: ";
   cin>>ra;

   //Read year number
   cout<<"Enter the number of years: ";
   cin>>yr;

   //calculate and print interst earned for
   //annual interst accumulation
   In= Amt*(pow((1+(ra/100)), yr));
   cout<<"Interest earned on annual accumulation is: ";
   cout<<In-Amt<<endl;

   //calculate and print interst earned for
   //semi-annual interst accumulation
   In= Amt*(pow((1+(ra/(2*100))), (2*yr)));
   cout<<"Interest earned on semi-annual accumulation is: ";
   cout<<In-Amt<<endl;

   //calculate and print interst earned for
   //quarterly interst accumulation
   In= Amt*(pow((1+(ra/(4*100))), (4*yr)));
   cout<<"Interest earned on quarterly accumulation is: ";
   cout<<In-Amt<<endl;

   //
   //system("pause");
   return 0;
}

Sample Run:


Related Solutions

Write a program that asks the user for an integer. The program checks and prints to...
Write a program that asks the user for an integer. The program checks and prints to the screen whether the number is prime or not. For example, if user enters 17, the program should print “17 is prime”; if the user enters 20, the program should print “20 is not prime”. please do it with a “ while Loop”, Thanks..
Write a short program that asks the user for a sentence and prints the result of...
Write a short program that asks the user for a sentence and prints the result of removing all of the spaces. Do NOT use a built-in method to remove the spaces. You should programmatically loop through the sentence (one letter at a time) to remove the spaces.
write a program to calculate and print payslips write program that calculates and prints payslips. User...
write a program to calculate and print payslips write program that calculates and prints payslips. User inputs are the name of employee, numbers of hours worked and hourly rate c++ language
a). Write a program that asks the user to enter an integer N and prints two...
a). Write a program that asks the user to enter an integer N and prints two integers, root and power, such that 1 < power < 6 and N = root ** power. If no such pair of integers exists, it should print a message to that effect. There are two loops, one for power and one for root. Order the loops so that if N = 64, then your program find that N = 8 ** 2 rather than...
Write a program that asks the user for an integer and then prints out all its...
Write a program that asks the user for an integer and then prints out all its factors. For example, when the user enters 84, the program should print 2 2 3 7 Validate the input to make sure that it is not a character or a string using do loop.in c++
Write a program checkerboard3x3.cpp that asks the user to input width and height and prints a...
Write a program checkerboard3x3.cpp that asks the user to input width and height and prints a checkerboard of 3-by-3 squares. (It should work even if the input dimensions are not a multiple of three.) . Don't use function. Example 1: Input width: 16 Input height: 11 Shape: *** *** *** *** *** *** *** *** *** *** *** * *** *** * *** *** * *** *** *** *** *** *** *** *** *** *** *** * *** *** *...
Write a C# program using repl.it that asks the user for three integers and prints the...
Write a C# program using repl.it that asks the user for three integers and prints the average value as a double. Example calculation (3 + 6 + 7) / 3 = 5.33333333333333 Given the data above, the output should be similar to: The average for the values entered is: 5.33333333333333 As always comments in your code are expected (what why how etc… ) Submit your repl.it link to the assignment dropbox text submission area.
Develop a program that asks a user to enter the number 10, and then it outputs...
Develop a program that asks a user to enter the number 10, and then it outputs COUNT-DOWN from 10 to 0. using for-loop
Develop a program that asks a user to enter the number 10, and then it outputs...
Develop a program that asks a user to enter the number 10, and then it outputs COUNT-DOWN from 10 to 0.
Code in C ++ that asks the user for an integer and that prints whether or...
Code in C ++ that asks the user for an integer and that prints whether or not the number is divisible by three in the integers. If the number is not divisible by three, the program must write a message indicating what the remainder is obtained by dividing the number by three.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT