CEIS170 COURSE PROJECT WEEK 7
Add the ability to save data to disk in one or more files. The menu(s) should give the user the
option to save or retrieve data.
Examples: In the programming tutorial, add a tutorial on w
...
CEIS170 COURSE PROJECT WEEK 7
Add the ability to save data to disk in one or more files. The menu(s) should give the user the
option to save or retrieve data.
Examples: In the programming tutorial, add a tutorial on working with files. Then add the ability
to save/retrieve user information or quiz results.
CODE:
#include
#include
#include
#include
#include
#include
using namespace std;
void menu(void);
void writeData(void);
void readData(void);
int main()
{
ofstream outputFile;
outputFile.open("DJ Playlist.txt");
//Variables
double lengthOfLoan, amountOfLoan, interestRate, monthlyPayment, loanTotal,
totalInterest;
char yes;
const int INPUT_CUSTOMER = 1, DISPLAY_LOAN = 2, INTEREST_ACQUIRED = 3,
TOTAL_LOAN = 4, MONTHS_TO_PAY = 5, EXIT_PROGRAM = 6;
string customerName;
int choice;
//Program
cout << "Welcome to the loan Calculator!\n";
cout << "Please make a selection from the list below.\n" << endl;
cout << "1.) To Enter Your loan Information." << endl;
cout << "2.) To view your Monthly Payments." << endl;
cout << "3.) View total amount of interest for the loan." << endl;
cout << "4.) Total Amount due." << endl;
cout << "5.) View total months remaining on loan." << endl;
cout << "6.) Exit the program" << endl;
do
{
cout << "Choose another Menu option. 1, 2, 3, 4, 5, or 6.... ";
cin >> choice;
while (choice < INPUT_CUSTOMER || choice > EXIT_PROGRAM)
{
cout << "Please enter a valid menu choice: ";
cin >> choice;
}
if (choice == 1)
{
cout << "What is the customers name? ";
cin >> customerName;
cout << "Enter the amount borrowed. $";
cin >> amountOfLoan;
cout << "What is the interest rate? % ";
cin >> interestRate;
cout << "How many months is the loan for? ";
[Show More]