Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Interest Rate + Principal Calculator Create a program that will that will calcul

ID: 3925136 • Letter: I

Question

Interest Rate + Principal Calculator Create a program that will that will calculate Yearly Interest or Compound Interest on a starting principal. Accept user input in dollars$ in main(). Program should not run if dollar amount > 0. Prompt user and exit the program.) Your program will have a menu. ************************************** * Main Menu: * * Enter # to run program or Quit * * 1) Yearly Interest Calculator * * 2) Compound Interest Calculator * * 3) Quit * ************************************** Yearly Interest Function: Create a function that accepts 3 arguments. 1 argument will represent savings 1 argument will represent years 1 argument will represent interest rate. Function will output each year's principal value. (Output will not be one singular value, but each year’s value.) So if years == 10, there will be 10 outputs. Compound Interest Function: Create a function that accepts 4 arguments. (Research on compound interest is required.) 1 argument will represent savings 1 argument will represent years 1 argument will represent interest rate. 1 argument will represent number of times it is compounded. Interest Rate + Principal Calculator Create a program that will that will calculate Yearly Interest or Compound Interest on a starting principal. Accept user input in dollars$ in main(). Program should not run if dollar amount > 0. Prompt user and exit the program.) Your program will have a menu. ************************************** * Main Menu: * * Enter # to run program or Quit * * 1) Yearly Interest Calculator * * 2) Compound Interest Calculator * * 3) Quit * ************************************** Yearly Interest Function: Create a function that accepts 3 arguments. 1 argument will represent savings 1 argument will represent years 1 argument will represent interest rate. Function will output each year's principal value. (Output will not be one singular value, but each year’s value.) So if years == 10, there will be 10 outputs. Compound Interest Function: Create a function that accepts 4 arguments. (Research on compound interest is required.) 1 argument will represent savings 1 argument will represent years 1 argument will represent interest rate. 1 argument will represent number of times it is compounded. Interest Rate + Principal Calculator Create a program that will that will calculate Yearly Interest or Compound Interest on a starting principal. Accept user input in dollars$ in main(). Program should not run if dollar amount > 0. Prompt user and exit the program.) Your program will have a menu. ************************************** * Main Menu: * * Enter # to run program or Quit * * 1) Yearly Interest Calculator * * 2) Compound Interest Calculator * * 3) Quit * ************************************** Yearly Interest Function: Create a function that accepts 3 arguments. 1 argument will represent savings 1 argument will represent years 1 argument will represent interest rate. Function will output each year's principal value. (Output will not be one singular value, but each year’s value.) So if years == 10, there will be 10 outputs. Compound Interest Function: Create a function that accepts 4 arguments. (Research on compound interest is required.) 1 argument will represent savings 1 argument will represent years 1 argument will represent interest rate. 1 argument will represent number of times it is compounded.

Explanation / Answer

#include <iostream>
#include<cmath>
using namespace std;

int simpleInterest(int principal,int years,int rate)
{
   int amount=0;
   for(int i=1;i<=years;i++)
   {
       float x=(rate*principal)/100;
       amount+=x;
       cout<<"amount : "<<amount<<endl;
   }
}
int compoundInterest(int principal,float rate,int time,int compounded)
{
   float P,R,T,CI;
   R=rate/100;
   P=pow(1+(rate/(compounded*100)),time);

   float amount=principal*P;
   float cInterest=amount-principal;
   cout<<"Amount: "<<amount<<" Compound Interest is : "<<cInterest;
}
int main() {
   // your code goes here
   cout<<"Enter # to run program or Quit * * 1) Yearly Interest Calculator * * 2) Compound Interest Calculator * * 3) Quit * ";
   int ch,time,compounded,rate,principal;
   cin>>ch;
   switch(ch)
   {
       case 1: cin>>principal>>time>>rate;
               if(principal<0)
                   return 0;
               simpleInterest(principal,time,rate);
               break;
       case 2: cin>>principal>>time>>rate>>compounded;
               if(principal<0)
                   return 0;
               compoundInterest(principal,(float)rate,time,compounded);
               break;
       case 3: return 0;
      
              
   }
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote