The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 4 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
I need help hierarchy chart showing the logical components of your program. Modularize your code according to your chart using the practices learned this week. Your menu should now call individual mo#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
   int placeOfBirth;
   int creditScore;
   int loanAmount;
   int monthOfLoan;
   int userChoice = 0;
   bool opening = true;
   float interest;
   string firstName;
   string lastName;
   while (opening == true)
   {
      // Prompt the user to enter new loan information, or retrieve previous information
      cout << "Enter Loan Information (1)" << endl;
      cout << "Retrieve Information (2)" << endl;
      cout << "Exit Program (3)" << endl;
      cin >> userChoice;
      // If the user enters an invalid option, re-prompt them
      // Otherwise, continue
      if (userChoice == 1 || userChoice == 2 || userChoice == 3)
      {
         opening = false;
      }
      else
      {
         cout << "Please enter either 1, 2 or 3!\n" << endl;
      }
   }
   // Loan Calculator
   if (userChoice == 1)
   {
      cout << "------ Loan Calculator ------" << endl;
      cout << "Enter your first name: " << endl;         //What it does
      cin >> firstName;
      cout << "Enter your last name: " << endl;
      cin >> lastName;
      cout << "Enter your desired loan amount: " << endl;
      cin >> loanAmount;
      cout << "Enter the desired loan length in months: " << endl;                //Input
      cin >> monthOfLoan;
      cout << "Enter your desired interest rate: " << endl;
      cin >> interest;
      double monthlyPayment = (loanAmount / monthOfLoan) * (1.00 + interest);
      cout << "The loan amount you entered is: $" << loanAmount << endl;
      cout << "The requested loan length: " << monthOfLoan << " months" << endl;
      cout << "Your requested interest rate: " << interest << "%\n" << endl;
      cout << "Your calculated monthly payments will be: $" << monthlyPayment << "/month" << endl;
      ofstream saveFile("Loan_info.txt");
      saveFile << "Name: " << firstName << " " << lastName << "\n";
      saveFile << "Monthly Payment: $" << monthlyPayment << "/month" << "\n";
      saveFile.close();
   }
   // Retrieve Information
   else if (userChoice == 2)
   {
      ifstream loadFile;
      loadFile.open("Loan_info.txt", ifstream::in);
      cout << "The file contains: \n";
      while (loadFile.good()) {
         cout << (char)loadFile.get();
      }
      loadFile.close();
   }
   //User choice 3 Exit
   else if (userChoice == 3)
   {
   cout << "Goodbye" << endl;
   }
   system("pause");
   return 0;
}dules to do the work of the program.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly