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
______ is/are the replacement of human operation and control of machinery with some form of programmed control.
Thepotemich [5.8K]
Automation is/are the replacement of human operation and control of machinery with some form of programmed control. Thank you for posting your question here at brainly. I hope the answer will help you. Feel free to ask more questions here.
7 0
3 years ago
Wich type of operating system is usually used in personal computers
Anvisha [2.4K]
The three most common operating systems for personal computers are Microsoft Windows, Apple Mac OS X, and Linux.
4 0
3 years ago
Read 2 more answers
Write a Python program to solve the problem described above. Define a function satisfactory_meal(Meal) which takes a single para
kompoz [17]

def dx(fn, x, delta=0.001):

   return (fn(x+delta) - fn(x))/delta

def solve(fn, value, x=0.5, maxtries=1000, maxerr=0.00001):

   for tries in xrange(maxtries):

       err = fn(x) - value

       if abs(err) < maxerr:

           return x

       slope = dx(fn, x)

       x -= err/slope

   raise ValueError('no solution found')

3 0
2 years ago
Encryption that uses 16-character keys is known as ____. strong 128-bit encryption strong 256-bit encryption military-strength 5
allsm [11]

Answer: Strong 128-bit encryption.

Explanation: An individual character corresponds to 8 bits . So if there are 16 characters then,

16\times8=128 bits keys

This makes the 128 bit key encryption the strongest amongst all other options.It is strongest because it is almost impossible to decode the 128-character key  by any method e.g.-brute-force method.

Other options are incorrect because the characters given by the other bits are as follows:  {\frac{256}{8}=32 characters

                         {\frac{512}{8}=64 characters

                         {\frac{512}{8}=128 characters  

Thus, the strongest character key is of 128 bits. for cipher.

3 0
2 years ago
Speech about society being normal
Kisachek [45]

Answer:

Do you know what is best about America? It’s really the fact that the right to equality has been ensured at the maximum level, and for all. And the citizens respect their family and this is being showcased proudly by Sir Donald Trump who not only looks after the whole US without ever hesitating no matter whatever might be the issue and at the same time also look after his great and proven proud family. And that explains in itself why America is so great. And this is a perfect specimen of an inordinate democracy, and that is why American Democracy is so fruitful. There is sufficient money, all sorts of resources, the most influential military, and the world's finest technology. And American history can be a petite one, but it is one of the most noticeable histories in the entire world. You will not find such a great history in any other part of the world. And George Washington, the father of the country set such an example that the next various generations of great leaders were able to build such a great America. It is a society where every citizen enjoys equal rights, and a day before Sir Trump issued various prisoners with graduate degrees, to help them to return to the mainstream of life. No other society in the whole world enjoys such a level of privileges on behalf of equality. And that’s why the US society can be termed as the most normal in the whole world.

Explanation:

Please check the answer section. And I have chosen US as it is the most fruitful democracy of the world. And I feel all the counrtries from the entire world, should learn a lesson from the short history of United States. This is the way in which we can sight a normal society.

3 0
2 years ago
Other questions:
  • Your brother is starting 9th grade next year and is thinking about going to college. What step would you recommend he take?
    14·1 answer
  • To change the overall design of an entire document to include colors, fonts, and effects, a user should apply a?
    8·2 answers
  • The ash and dust from a volcanic eruption can cause a _______ change in the environment.
    13·1 answer
  • A media scholar is trying to find out whether internet or television political ads are more persuasive. what kind of effects is
    7·1 answer
  • Which type of styles can be applied to a word, phrase, or sentence?
    7·1 answer
  • To add a new kind of information into the database you need to add a new table<br> true or false?
    7·2 answers
  • Write a program in python to test if given number is prime or not.
    6·2 answers
  • 14. Which of the following is NOT a
    6·2 answers
  • HELLLLLLLLPPPPPPPPPPPP HHHHHHHHHEEEEEEEEELLLLLLPPPPPP MEEEEEEEE
    12·2 answers
  • Give one (1) advantage and one(1) disadvantage of using and integrated software package over a custom written one.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!