Question

Suppose billingAmount is a double variable, which denotes the amount you need to pay to the...

Suppose billingAmount is a double variable, which denotes the amount you need to pay to the department store. If you pay the full amount, you get $10.00 or 1% of the billingAmount, whichever is smaller, as a credit on your next bill. If you pay at least 50% of the billingAmount, the penalty is 5% of the unpaid balance. If you pay at least 20% of the billingAmount and less than 50% of the billingAmount, the penalty is 10% of the unpaid balance; otherwise the penalty is 20% of the unpaid balance. Design an algorithm that prompts the user to enter the billing amount and the desired payment. The algorithm then calculates and outputs the credit or remaining balance. If the amount is not paid in full, the algorithm should also output the penalty amount.

#include<iostream>


#include<cmath>


using namespace std;


// THis function calculates the penality


// returns +ve if the amount needs to get credited.


// negative if penalty


double calculatePenality(doubleamount, double payment){


 


double remaining = amount - payment;


if(amount == payment){


return min(0.01*amount, 10.0);


}else if(payment >= 0.5*amount){


return -(0.05*remaining) ;


}else if(payment >= 0.2*amount){


return -(0.1*remaining) ;


}


else


{


return -(0.2*remaining) ;


}


}


for this algorithm create and IPO chart to include a description of the user inputs and the constants supplied by the program statement, the processing algorithm and a description of the program output

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Input-Processing-Output Chart

Input Data

Processing Steps

Output Data

The BillingAmount purchased

The Payment Paid

Get the BillingAmount Purchased

Get the Payment Paid

Subtract BillingAmout and PaymenyPaid to get Remaining Balance

if the BillingAmount Purchased is equal to Payment paid then Credit = 10% of payment paid


if the Payment paid is greater than 50% of BillingPaid then return 5% of remaining balance as penalty

If the payment paid is greater than 20% and less than 50% of billing amount then return 10% of remaining balance As penalty

if payment paid is less than 20% of billing amount them return 20% of remaining balance as penalty

Credit

Remaining Balance= Billing Amount -Payment Paid

Penalty

Add a comment
Know the answer?
Add Answer to:
Suppose billingAmount is a double variable, which denotes the amount you need to pay to the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • COP 2220 Into programming in C(Answer in C, not C++). The question is: Please write the...

    COP 2220 Into programming in C(Answer in C, not C++). The question is: Please write the algorithm for a AppStore programming assignment. The details of the assignment, a sample algorithm, and its outline, are located below. Make the algorithm at least half a page, easy to read, and to understand, how it works. I just want the algorithm, not the programming code, I have that. I only need the ALGORITHM. Thanks for helping me out, I apprieciate it, have a...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • Suppose you buy a fridge for $1580. You agree to pay off the total amount with...

    Suppose you buy a fridge for $1580. You agree to pay off the total amount with monthly payments over 2 years at j12= 11%. If you wish to refinance you will have to pay a penalty equal to 4 months' interest on the outstanding balance. After 12 payments you see that interest rates at your bank are j12j = 6.5%. (a) Calculate the original monthly payment. Answer: $ (b) Calculate the new monthly payment if you were to refinance under...

  • I need to get this two last parts of my project done by tonight. If you...

    I need to get this two last parts of my project done by tonight. If you see something wrong with the current code feel free to fix it. Thank you! Project 3 Description In this project, use project 1 and 2 as a starting point and complete the following tasks. Create a C++ project for a daycare. In this project, create a class called child which is defined as follows: private members: string First name string Last name integer Child...

  • please help, In this lab, you complete a C++ program with the provided data files. The program calculates the amount of...

    please help, In this lab, you complete a C++ program with the provided data files. The program calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take- home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay. Instructions Ensure the source code file named Payroll.cpp is open in the code editor. Variables have been...

  • Your program will ask the user to enter the amount of money they want to borrow,...

    Your program will ask the user to enter the amount of money they want to borrow, the interest rate, and the monthly payment amount. Your program will then determine how many months it will take to pay off that loan, what the final payment amount will be, and how much interest was paid over that time. If the monthly payment amount isn't high enough to pay off more than one month's interest, your program should notify the user what the...

  • I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instruction...

    I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...

  • A) One of the problems that have been discussed in the class is to write a...

    A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following: int main() { double radius; double area; double circumference; //the radius...

  • A) One of the problems that have been discussed in the class is to write a simple C++ program to ...

    C++ programming question will upvote A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following int main //the radius of the...

  • You are to write a program IN C++ that asks the user to enter an item's...

    You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT