Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

: Create a hierarchy chart showing the logical components of your program. Modularize your code according to your chart using the practices learned this week.

: Create a 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.

#include

#include

#include

using namespace std;

//int calculate();

//int compareLetters(char Answers, int questions);

int main() {

double monthlyPayment;

double interestRate;

double loanAmount;

double month = 0;

int answer_1;

double balance; //Balance due

double monthPaidInt; //Month interest paid

char ch = 'Y';

int choice;

cout.setf(ios::fixed); // currency format into 2 decimal points

cout.setf(ios::showpoint);

cout.precision(2);

// array holds start program input

char menu[2][100] = { "Menu: Start Process (s) " , "Menu: Quit the Process (q) " };

int choiNos[2] = { 1, 2, };

//char timing[2][100] = { "Time: 1:00pm", "Time: 3:00pm" };

cout << "Welcome national Bank " << endl;

cout << "We are please in assisting you in your banking needs" << endl;

cout << "Menu" << endl;

cout << "Want to start or do you want to quit?"

<< " Enter '1' for start, or '2' to quit." << endl;

while (true)

{

//Ask user if they want to start or quit

cin >> answer_1;

if ( answer_1 >2)

{

cout << "Menu ";

cout << " Enter '1' for start, and time 2. quit ";

}

else {

break;

}

}

if (answer_1 == 1) {

cout << "We are Open to start at this time " << endl;

while (ch == 'y' || ch == 'Y') {

//user prompt for gate number

for (int i = 0; i < 2; i++) {

cout << (i + 1) << ". " << menu[i] << endl;

}

//validate user input in a loop

while (true) {

bool valid = false;

cout << endl << "Please enter your choice number : ";

cin >> choice;

for (int i = 0; i < 2; i++) {

if (choiNos[i] == choice) {

valid = true;

break;

}

}

if (!valid) {

cout << "Invalid entery!" << endl;

continue;

}

break;

}

// input

cout << "Enter the current balance of your loan: $";

cin >> loanAmount;

cout << "Enter the interest rate : ";

cin >> interestRate;

cout << "Enter the monthly payment : $";

cin >> monthlyPayment;

// calculate interst rate

while (interestRate >= 1)

{

interestRate = interestRate / 100;

}

balance = loanAmount* (1 + interestRate / 12) - monthlyPayment;

//

cout << "month 1 your balance is $" << balance << endl;

while (balance > 0)

{

balance = balance * (1 + interestRate / 12) - monthlyPayment;

month = month++;

cout << " month " << month << ", your balance is : $" << balance << endl;

}

cout << "Press Enter to end -->" << endl;

}

system("pause");

}

}

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

What are the three basic functions of management?

Answered: 1 week ago

Question

=+and non-compete agreements in three to five different countries.

Answered: 1 week ago