Write a program that prompts the user to enter the account’s present value, monthly interest rate, and the number of months that the money will be left in the account. The program should pass these values to a function named futureValue that returns the future value of the account, after the specified number of months. The program should display the account’s future value.
11.Future Value chapter 1 to 6 terminology only!!!!
Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula, which is known as the future value formula, is
The terms in the formula are as follows:
-
F is the future value of the account after the specified time period.
-
P is the present value of the account.
-
i is the monthly interest rate.
-
t is the number of months.
Write a program that prompts the user to enter the account’s present value, monthly interest rate, and the number of months that the money will be left in the account. The program should pass these values to a function named futureValue that returns the future value of the account, after the specified number of months. The program should display the account’s future value.
below is the code// how to add it to this code below under void challenge 10
//use only chapter 1-6 terminology!!
// must validate input using do while loop examle line 98 - 108
// //call functions and follow the challenge instructions
//Description: Assignment6 C++ Chapter 6
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
// Function prototypes
int menuOption();
double getSales(string divisionName);
void findHighest(double salesNE, double salesSE, double salesNW, double salesSW);
void Challenge3();
double fallingDistance(int time);
void Challenge5();
double celsius();
void Challenge7();
void Challenge9();
void Challenge10();
void Challenge11();
void Challenge18();
void Challenge20();
void Challenge23();
void Challenge24();
// driver function
int main()
{
do
{
switch (menuOption())
{
case 0: exit(1); break;
case 3: system("cls"); Challenge3(); break;
case 5: system("cls"); Challenge5(); break;
case 7: system("cls"); Challenge7(); break;
case 9: system("cls"); Challenge9(); break;
case 10: system("cls"); Challenge10(); break;
case 11: system("cls"); Challenge11(); break;
case 18: system("cls"); Challenge18(); break;
case 20: system("cls"); Challenge20(); break;
case 23: system("cls"); Challenge23(); break;
case 24: system("cls"); Challenge24(); break;
default: cout << "\t\tERROR - Invalid option. Please re-enter."; break;
}
cout << "\n";
system("pause");
} while (true);
return EXIT_SUCCESS;
}
int menuOption()
{
system("cls");
cout << "\n\t\tChapter 6: Functions (page 372-380) ";
cout << "\n\t" + string(60, char(205));
cout << "\n\t\t 3. Winning Division ";
cout << "\n\t\t 5. Falling Distance ";
cout << "\n\t\t 7. Celsius Temperature Table ";
cout << "\n\t\t 9. Present Value ";
cout << "\n\t\t 10. Future Value ";
cout << "\n\t\t 11. Lowest Score Drop ";
cout << "\n\t\t 18. Paint Job Estimator ";
cout << "\n\t\t 20. Stock Profit ";
cout << "\n\t\t 23. Prime Number List ";
cout << "\n\t\t 24. Rock, Paper, Scissors Game";
cout << "\n\t" + string(60, char(196));
cout << "\n\t\t 0. Quit";
cout << "\n\t" + string(60, char(205));
cout << "\n\t\t Option: ";
int option;
cin >> option;
cin.clear();
cin.ignore(999, '\n');
return option;
}
double getSales(string divisionName)
{
double sales; // local variable
do
{
cout << "Enter the quarterly sales for " << divisionName << ": $";
cin >> sales;
if (sales < 0)
cout << "Error: invalid input sales.\n";
else
return sales;
} while (true);
}
//declaring prototype
void findHighest(double salesNE, double salesSE, double salesNW, double salesSW)
{
if (salesNE >= salesSE && salesNE >= salesNW && salesNE >= salesSW)
cout << "Sales North East: $" << salesNE;
else if (salesSE >= salesNE && salesNE >= salesNW && salesSE >= salesSW)
cout << "Sales South East: $" << salesSE;
else if (salesNW >= salesNE && salesNE >= salesNW && salesSE >= salesSW)
cout << "Sales NorthWest: $" << salesNW;
else
cout << "Sales South West: $" << salesSW;
}
// Winning Division - page 373
void Challenge3()
{
double salesNE = getSales("NorthEast");
double salesSE = getSales("SouthEast");
double salesNW = getSales("NorthWest");
double salesSW = getSales("SouthWest");
//Output
findHighest(salesNE, salesSE, salesNW, salesSW);
}
double fallingDistance(int time)
{
return 0.5 * 9.8 * pow(time, 2);
}
// Falling Distance - pg 374
void Challenge5()
{
int time = 0;
// do while loop for validation
do
{
cout << "Enter the time in seconds: ";
cin >> time;
if (time < 0)
cout << "Error: invalid input time.\n";
else
break; // break out of the loop
} while (true);
cout << "The distance: " << fallingDistance(time) << '\n';
}
//Celsius Temperature Table
double celsius(double c, double f)
{
return 0.0;
}
void Challenge7()
{
const int minTemp = 0
}
void Challenge9()
{
// You will implement
}
void Challenge10()
{
// write code here
}
void Challenge11()
{
// You will implement
}
void Challenge18()
{
// You will implement
}
void Challenge20()
{
// You will implement
}
void Challenge23()
{
// You will implement
}
void Challenge24()
{
// You will implement
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images