1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iren2701 [21]
3 years ago
8

2) [13 points] You’ve been hired by Banker Bisons to write a C++ console application that determines the number of months to rep

ay a car loan. Write value function getLoanAmount that has no parameters, uses a validation loop to prompt for and get from the user a car loan amount in the range $2,500-7,500, and returns the loan amount to function main. Write value function getMonth Payment that has no parameters, uses a validation loop to prompt for and get from the user the monthly payment in the range $50-750, and returns the monthly payment to function main. Write value function getInterestRate that has no parameters, uses a validation loop to prompt for and get from the user the annual interest rate in the range 1-6%, and returns the interest rate to function main. Here are the first lines of the three functions:

Computers and Technology
1 answer:
Paha777 [63]3 years ago
5 0

Answer:

Check the explanation

Explanation:

CODE:

#include <iostream>

#include <iomanip>

using namespace std;

double getLoanAmount() { // functions as per asked in question

double loan;

while(true){ // while loop is used to re prompt

cout << "Enter the car loan amount ($2,500-7,500): ";

cin >> loan;

if (loan>=2500 && loan <= 7500){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: $"<< loan << " is an invalid loan amount." << endl;

}

}

return loan;

}

double getMonthlyPayment(){ // functions as per asked in question

double monthpay;

while(true){ // while loop is used to re prompt

cout << "Enter the monthly payment ($50-750): ";

cin >> monthpay;

if (monthpay>=50 && monthpay <= 750){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: $"<< monthpay << " is an invalid monthly payment." << endl;

}

}

return monthpay;

}

double getInterestRate(){ // functions as per asked in question

double rate;

while(true){ // while loop is used to re prompt

cout << "Enter the annual interest rate (1-6%): ";

cin >> rate;

if (rate>=1 && rate <= 6){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: "<< rate << "% is an invalid annual interest rate." << endl;

}

}

return rate;

}

int main() {

cout << setprecision(2) << fixed; // to print with 2 decimal places

int month = 0; // initializing month

// calling functions and storing the returned value

double balance= getLoanAmount();

double payment= getMonthlyPayment();

double rate= getInterestRate();

rate = rate /12 /100; // as per question

// printing as per required in question

cout << "Month Balance($) Payment($) Interest($) Principal($)"<< endl;

while(balance>0){ // while the balance is more than zero

month = month + 1; // counting Months

// calculations as per questions

double interest = balance * rate;

double principal = payment - interest;

balance = balance - principal;

// printing required info with proper spacing

cout <<" "<< month;

cout <<" "<< balance;

cout <<" "<< payment;

cout <<" "<< interest;

cout <<" "<< principal << endl;

}

cout << "Months to repay loan: " << month << endl; // displaying month

cout << "End of Banker Bisons";

Kindly check the output in the attached image below.

You might be interested in
You may nest while and do-while loops, but you may not nest for loops<br><br><br><br> True False
morpeh [17]

Answer:

You may nest while and do-while loops, but you may not nest for loops - False

4 0
3 years ago
Explain each kind of pointer and for what it is appropriate.
Mademuasel [1]

Pointer: A pointer is a variable which holds the address of other variable of the specified data type(like int,float,char). In programming we basically use pointers to store the other variable's address.

3 0
3 years ago
Read 2 more answers
Lucy has to move data from column A to column N in a worksheet. Which keys should she select to move data in the same worksheet?
Taya2010 [7]
If Lucy wants to move data from column A to column N within the same worksheet, she needs to use the Ctrl + c and Ctrl + v keys. But before these key combination, she needs to select first the column A by merely clicking the column A, then ctrl+c and ctrl+v.
8 0
3 years ago
Read 2 more answers
PLEASE HELP! I accidently looked up a link, and now this same link keeps popping up everywhere, how do I stop this!?!? please he
Black_prince [1.1K]

Answer:

Try restarting your phone

Explanation:

8 0
2 years ago
Read 2 more answers
Universal Container sales reps can modify fields on an opportunity until it is closed. Only the sales operations team can modify
spayn [35]

Answer:

The answer is D. Use multiple record types, page layouts, and profiles

Explanation:

Universal container sales reps can modify fields on an opportunity until it is closed. Only the sales operations team can modify the post close follow up date and post close followup comments fields. How to make this happen

A. Use field-level security on page layouts to restrict editing fields

B. Use field-level security to mark fields as read=only on the sales profile

C. use record types with field sets and restrict editing fields using field-level security

D. Use multiple record types, page layouts, and profiles

3 0
3 years ago
Other questions:
  • Technology progresses so new needs can be satisfied.<br><br> A. true<br><br> B. false
    12·2 answers
  • Selecting the option to control Widows and Orphans will prevent _________. A single line from appearing at the top or bottom of
    10·1 answer
  • Computer maker Dell realized the problems with keeping large inventories, especially because of the fast rate of obsolescence of
    7·1 answer
  • You can change the transparency of a picture used as a slide’s background with the ____.
    10·1 answer
  • What are the ethical implications of online social media after someone has died
    8·2 answers
  • PLEASE HELP ASAP!!! 99 POINTS FOR 3 MULTIPLE CHOICE QUESTIONS!!! PLEASE ANSWER ALL!!!
    8·1 answer
  • What is a geam in the ggplot2 system?
    5·1 answer
  • Stacy plans to print her contacts and would like to choose an option that will print select information for each contact in a bu
    11·1 answer
  • 19 dollar fortnite giftcard who wants it
    15·2 answers
  • Does anyone have Rblx? if so write your username
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!