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
Which is a benefit of traditional SLR cameras over digital cameras? A. They produce negatives to serve as backups. B. They make
VLD [36.1K]

B. They make it easy to take panoramic photographs of the crime scene.

Explanation:

  • SLR is the single-lens reflex analog camera with dated looks. Traditional SLR has more manual controls and no monitor on the rear.  
  • A DSLR or Digital Single Lens Reflex camera is a facelift of the traditional SLRs. They are pricey but have the power of capturing minutest details.  
  • SLRs give more opportunity for creativity. They give an important competition to digital cameras in pixel output too.  
  • However, if the quality is paramount invest in a good SLR.

6 0
3 years ago
Y'+2y = 5-e^(-4x), y(0)=-11
Anastaziya [24]

Answer:

  see attached

Explanation:

A differential equation solver says the exact solution is ...

  y = 5/2 -14e^(-2x) +1/2e^(-4x)

The y-values computed by Euler's method will be ...

  y = ∆x·y' = 0.1(5 - e^(-4x) -2y)

The attached table performs these computations and compares the result. The "difference" is the approximate value minus the exact value. (When the step size is decreased by a factor of 10, the difference over the same interval is decreased by about that same factor.)

4 0
3 years ago
You have installed Windows Server 2016 on a new server and want to centralize user logons and security policies. What type of so
shusha [124]

Answer:

Directory Service

Explanation:

3 0
2 years ago
This form of analysis is an extension of what-if analysis and is the study of the impact on other variables when one variable is
Elenna [48]

Answer: (C) Sensitivity analysis

Explanation:

 The sensitivity analysis is also known as simulation analysis or "What-if" analysis as, it is basically used for the outcome prediction of the decision making in various range of the given variable.

It is used by making a given arrangement of factors, an investigator can decide that how changing in a single variable influence the final result.

The sensitivity analysis is the process for investigation of how the vulnerability in the yield of a scientific model or framework can be isolated in the system.  

Theretofore, Option (C) is correct as all the other options does not involve in the study of variable and also others are not the extension of what-if analysis.

3 0
3 years ago
"what do you perform when you want to recall specific records from a database"
Ivan
A select query


select column1, column2, columnN
from table
where condition
order to be pretty;
5 0
3 years ago
Other questions:
  • A hacker changing the ip addresses used in conjunction with a particular company’s web site to re-route them to the hacker’s ser
    11·1 answer
  • Effective note-taking helps support<br><br> action.<br> distinction.<br> distraction.<br> retention.
    9·2 answers
  • When using a wireless mouse, what is the most common port used for the transmitter? 
    7·1 answer
  • Which are valid double statements for java? double a = 0; double b = -1.0; double c = -425; double d = 6340; double e = -1.0; do
    12·2 answers
  • The benefits of flextime include:
    11·2 answers
  • The system restore utility can be started from command line using what executable?
    11·1 answer
  • PLEASE HELP!! WILL MARK BRAINLIEST!!
    9·1 answer
  • Help me asap please
    15·1 answer
  • Which one way in which using infrared in game console controllers could affect the experience of a person playing the game?
    8·1 answer
  • Gaining information by tricking an individual into releasing information is often referred to as.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!