Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to hierarchy chart showing the logical components of your program. Modularize your code according to your chart using the practices learned this week. Your

How to 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 modules to do the work of the program.

Here is the code below. How would I create the hierarchy chart and modularize the code. I need a small example of what needs to be done here so I can complete the entire assignment.

#include

#include

#include

#include

#include

using namespace std;

int main()

{

// declare variables

vector termOfLoan;

vector loanAmnt;

vector interestRate;

vector totalLoanAmnt(50);

vector totalInterest(50);

vector monthlyPayment(50);

char yes;

const int Input_Customer = 1;

const int Display_Loan = 2;

const int Exit_Program = 3;

vector CustName;

int choice;

int numOfCustomers = 0;

int index = 0;

//Program

cout << " Welcome to the loan Calculator!" << endl;

cout << " You will be asked to enter the amount of your loan," << endl;

cout << " the interest rate, and lenth you would like your loan for." << endl;

cout << " The program will then tell you your monthly payment." << endl << endl;

do

{

cout << " Financial calculator menu:" << endl << endl;

cout << " 1. Enter customer information" << endl;

cout << " 2. Display your loan information" << endl;

cout << " 3. exit the program" << endl << endl;

cout << " Enter a menu option: ";

cin >> choice;

while (choice < Input_Customer || choice > Exit_Program)

{

cout << " Select a menu option: ";

cin >> choice;

}

if (choice == 1)

{

cout << "Enter the number of people applying for a loan today" << endl;

cin >> numOfCustomers;

for (index = 0; index < numOfCustomers; index++)

{

string tempName;

double temploanAmnt, tempInterestRate, temptermOfLoan;

cout << endl << " What is your name?" << endl;

cin >> tempName;

CustName.push_back(tempName);

cout << endl << " How much do you need to borrow " << CustName[index] << "?" << endl;

cin >> temploanAmnt;

loanAmnt.push_back(temploanAmnt);

cout << endl << CustName[index] << " What is your ideal interest rate for the loan" << endl;

cin >> tempInterestRate;

interestRate.push_back(tempInterestRate);

cout << endl << CustName[index] << " how long do you want your loan term?" << endl;

cin >> temptermOfLoan;

termOfLoan.push_back(temptermOfLoan);

//Calculations

totalInterest[index] = loanAmnt[index] * interestRate[index];

totalLoanAmnt[index] = loanAmnt[index] + totalInterest[index];

monthlyPayment[index] = totalLoanAmnt[index] / termOfLoan[index];

}

}

if (choice == 2)

{

//Display monthly payment

cout << fixed << setprecision(2);

for (index = 0; index < numOfCustomers; index++)

{

cout << endl << CustName[index] << " your momthly payment will be " << monthlyPayment[index] << endl;

cout << endl << " with a total of $" << totalLoanAmnt[index] << endl;

cout << endl << " for " << termOfLoan[index] << " months " << endl;

cout << endl << " and your ideal interest rate of " << interestRate[index] << " was given." << endl;

cout << endl << " Do you want to accept these terms? Y/N: " << endl;

cin >> yes;

if (yes == 'Y' || yes == 'y')

{

cout << endl << "Congradulations " << CustName[index] << " lets sign the documents and your all set!" << endl;

}

else

cout << endl << " Let's start over and select new terms so we can meet your budget." << endl;

}

}

} while (choice != Exit_Program);

system("pause");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions