Sample Output 1 Would you like to take out a loan? maybe Invalid choice; please enter yes or no. Would you like to take out a loan? Yes How much would you like to borrow? 45000 What is your yearly income? 15000 Congratulations! Your loan request for $45000 has been accepted!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
100%

Do not use any global variable. Properly send arguments to functions and use their return values

You will use the flowchart to design and write a program that uses a function for each step. Write
a program named loan.cpp that defines and calls the following functions, EXACTLY as
specified below:
askLoan ()
o Return type: bool
o Parameter(s): None
askIncome ()
o Return type: double (income)
o Parameter(s): None
askAmount ()
o Return type: double (loan)
o Parameter(s): None
decideLoan ()
o Return type: bool
Parameter(s): double (income), double (loan)
Validate all user input using loops:
When validating the user input for askLoan (), accept the following user input for each
choice:
"Yes", "Y", "yes", and "y" returns true
"No", "N", "no", and "n" returns false
When validating the user input for askIncome () and askAmount (), make sure the
input is greater than or equal to 0.
Sample Output 1
Would you like to take out a loan?
maybe
Invalid choice; please enter yes or no.
Would you like to take out a loan?
Yes
How much would you like to borrow?
45000
What is your yearly income?
15000
Congratulations! Your loan request for $45000 has been
accepted!
Transcribed Image Text:You will use the flowchart to design and write a program that uses a function for each step. Write a program named loan.cpp that defines and calls the following functions, EXACTLY as specified below: askLoan () o Return type: bool o Parameter(s): None askIncome () o Return type: double (income) o Parameter(s): None askAmount () o Return type: double (loan) o Parameter(s): None decideLoan () o Return type: bool Parameter(s): double (income), double (loan) Validate all user input using loops: When validating the user input for askLoan (), accept the following user input for each choice: "Yes", "Y", "yes", and "y" returns true "No", "N", "no", and "n" returns false When validating the user input for askIncome () and askAmount (), make sure the input is greater than or equal to 0. Sample Output 1 Would you like to take out a loan? maybe Invalid choice; please enter yes or no. Would you like to take out a loan? Yes How much would you like to borrow? 45000 What is your yearly income? 15000 Congratulations! Your loan request for $45000 has been accepted!
A bank uses the following flowchart to determine whether a customer is eligible for a loan. It
contains four steps, separated by color.
START HERE
bool askLoan()
How much would you
like to borrow?
Would you like to take
Invalid choice
out a loan?
double
cin >> loan
Yes
askAmount()
Yes/Y/yes/y
Please enter yes or no
or
No/N/no/n
if loan < 0
Please enter positive #
No
Thanks for visiting the bank!
bool decideload(double income, double loan)
if income <= 10,000
What is your yearly
Income?
if income * 5 >= loan
ACCEPT
REJECT
double
askincome()
if income > 10,000
and income < 100,000
cin >> income
if income 5 < loan
REJECT
if income <0
Please enter positive #
if income >= 100,000
ACCEPT
Transcribed Image Text:A bank uses the following flowchart to determine whether a customer is eligible for a loan. It contains four steps, separated by color. START HERE bool askLoan() How much would you like to borrow? Would you like to take Invalid choice out a loan? double cin >> loan Yes askAmount() Yes/Y/yes/y Please enter yes or no or No/N/no/n if loan < 0 Please enter positive # No Thanks for visiting the bank! bool decideload(double income, double loan) if income <= 10,000 What is your yearly Income? if income * 5 >= loan ACCEPT REJECT double askincome() if income > 10,000 and income < 100,000 cin >> income if income 5 < loan REJECT if income <0 Please enter positive # if income >= 100,000 ACCEPT
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education