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.
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: *** *** *** *** *** *** *** *** *** *** *** * *** *** * *** *** * *** *** *** *** *** *** *** *** *** *** *** * *** *** *...
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.
A program written in C that asks for the distance to be entered and then prints...
A program written in C that asks for the distance to be entered and then prints the fare A transportation company has the following rates For the first 100 miles                                                       20 cents a mile For the next 100 miles                                                       a) + 10 cents per mile over 100 miles For the next 100 miles                                                       b) + 8 cents per mile over 200 miles more than 300 miles                                                          c) + 5 cents per mile over 300 miles Write a program that asks...
Q9) Write a function that asks the user for a number and prints out the multiplication...
Q9) Write a function that asks the user for a number and prints out the multiplication table for that number. Python3 Q10)Write a function that takes two integer inputs for width and length, and prints out a rectangle of stars. (Use * to represent a star). Q11)Write a program that reads in a string and prints whether it: [Hint: given a character like ‘H’ you can apply to it the method ‘H’.isalpha() to check if it is a letter or...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT