Question: Create a new Java file called CalendarOrderYourLastName with a public static void main. Create three overloaded computeOrderTotal() methods. When computeOrderTotal() receives a single double parameter,
Create a new Java file called CalendarOrderYourLastName with a public static void main.
Create three overloaded computeOrderTotal() methods.
When computeOrderTotal() receives a single double parameter, it represents the price of one calendar ordered. Add 7% tax and return the total due as a double.
When computeOrderTotal() received two parameters, they represent the price of a calendar and the quantity ordered (int). Multiply the two values, add 7% tax and return the total due.
Finally, when computeOrderTotal() receives three parameters, they represents the price of a calendar, the quantity ordered, and a coupon value represented in decimal. Multiple the quantity and price for a new subtotal. Compute the coupon discount amount by multiplying the coupon value by subtotal. Reduce the subtotal by the calculated coupon value. Finally, add 7% tax (based on the new subtotal with the discount) and return the total due.
In the main method, call each method testing to make sure you receive the correct values and back. For example, with these calls (using printf to two decimals), I would receive the following:
computeOrderTotal(11.99); //12.83
computeOrderTotal()(11.99, 3); // 38.49
computeOrderTotal()(11.99, 3, .1); // 34.64
If you're not getting the correct value for the third method run, check how you are performing your math. This is typically the error. Remember: no views should be used in your methods (no printing from the computeOrderTotal( ) method). Submit your CalendarOrderYourLastName to this assignment when you are finished.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
