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. Your

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. Examples: In the Programming Tutorial, add a tutorial on working with modules. Then, modularize the code so that each tutorial and quiz is in a module.

#include "stdafx.h"

#include

using namespace std;

struct customer {

string name;

double loan_amount;

double interest_rate;

int lengthOfloan;

};

int main()

{

cout << "Welcome to the Loan Payment Calculator ";

struct customer arr[5];

arr[0] = { "john",10000,12,3 };

arr[1] = { "Roy",12000,9,2 };

arr[2] = { "james",13000,8,4 };

arr[3] = { "ramesh",15000,4,10 };

arr[4] = { "ravi",20000,5,12 };

int size = 5;

string name;

string loanOption;

double interestRate = 0, amountOfLoan = 0, interest;

int lengthOfLoan, loanSummary;

int i;

while (1) {

cout << "What is your name?";

cin >> name;

cout << "Hi " << name << " ";

for (i = 0; i

if (name == arr[i].name)break;

if (i == size) {

cout << "Sorry you are not in the list Try Again! ";

continue;

}

int menu;

do {

cout << "Loan Payment Calculator Menu ";

cout << "1 - Customer - Loan ";

cout << "2 - Delete a Customer - Loan ";

cout << "3 - Display a Loan Summary ";

cout << "4 - Exit ";

cout << "Please choose 1 - 4: ";

cin >> menu;

if (menu == 1)

cout << "Hi " << name << "your loan is " << arr[i].loan_amount;

if (menu == 2) {

cout << "Are you sure you want to delete this customer?(y/n) : ";

char option;

cin >> option;

if (option == 'y') {

for (int j = i; j

arr[j] = arr[j + 1];

size--;

}

}

if (menu == 3) { cout << arr[i].loan_amount << " interest rate = " << arr[i].interest_rate << " length of loan = " << arr[i].lengthOfloan; }

else { cout << "Exit"; }

} while (menu != 4 && menu>0);

interest = (arr[i].loan_amount * arr[i].interest_rate * arr[i].lengthOfloan) / 100;

cout << " Your interest rate is : " << interest << " ";

}

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago