C Interest Rate Principal Calculator Create a program that
C++
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 numbers of times it is compounded.
Please attach snipping photos of source code and output from each function.
Sample:
Please enter $ in savings.
3334
Please enter number of years.
3
Please enter number of years.
1.0
Year 1 = $3367.34
Year 2 = $3401.01
Year 3 = $3435.02
Sample:
Please enter $ in savings
3334
Please enter number of years
1
Please enter interest rate
1.0
Number of times compounded
3
Principle Compounded 1 = $3367.34
Principle Compounded 2 = $3401.01
Principle Compounded 3 = $3435.02
Solution
HI, Friend, You have not mentioned the details about how to calculate YearlyInterest and CompoundCAlculator.
I have coded every thing except the logic to calculate interest/amount.
Please replace/implement with actual code in my function or give me details about those formula.
Please find my program.
#include <iostream>
#include <cmath>
using namespace std;
// function declaration
void displayMenu();
void YearlyInterestCalculator(double amount , int year, double rate);
void CompoundInterestCalculator(double amount, int year, int rate, int times);
int main(){
// variable declaration
double amount, rate;
int year, times, option;
// calling displayMenu function
displayMenu();
cin>>option;
if(option == 1){
cout<<\"Please enter $ in savings.\"<<endl;
cin>>amount;
// validating amount
while(amount < 0){
cout<<\"Please enter $ in savings.\"<<endl;
cin>>amount;
}
cout<<\"Please enter number of years.\"<<endl;
cin>>year;
cout<<\"Please enter interest rate.\"<<endl;
cin>>rate;
// calling function
YearlyInterestCalculator(amount, year, rate);
}
else if(option == 2){
cout<<\"Please enter $ in savings.\"<<endl;
cin>>amount;
// validating amount
while(amount < 0){
cout<<\"Please enter $ in savings.\"<<endl;
cin>>amount;
}
cout<<\"Please enter number of years.\"<<endl;
cin>>year;
cout<<\"Please enter interest rate.\"<<endl;
cin>>rate;
cout<<\"Number of times compounded.\"<<endl;
cin>>times;
// calling function
CompoundInterestCalculator(amount, year, rate, times);
}
}
// function definations
void displayMenu(){
cout<<\"**************************************\"<<endl;
cout<<\"* Main Menu: *\"<<endl;
cout<<\"* Enter # to run program or Quit *\"<<endl;
cout<<\"* 1) Yearly Interest Calculator *\"<<endl;
cout<<\"* 2) Compound Interest Calculator *\"<<endl;
cout<<\"* 3) Quit *\"<<endl;
cout<<\"**************************************\"<<endl;
}
// TODO: please replace with correct formula
void YearlyInterestCalculator(double amount , int year, double rate){
for(int i=1; i<=year; i++){
double interest = (amount*year*rate)/100.0;
amount = amount + interest;
cout<<\"Year \"<<i<<\" = $\"<<amount<<endl;
}
}
// TODO : no idea about formula
void CompoundInterestCalculator(double amount, int year, int rate, int times){
}
Please let me know in case of any help


