Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are developing a class named ShoppingCart to handle an online grocery store. The ShoppingCart class includes three overloaded methods named calculateTotal ( ) for
You are developing a class named ShoppingCart to handle an online grocery store. The ShoppingCart class includes three overloaded methods named calculateTotal for computing the total bill.
i The first calculateTotal method takes a single parameter, which represents the price of a single item in the shopping cart. It should calculate and return the total due after adding an tax.
ii The second calculateTotal method takes two parameters, representing the price of an item and the quantity ordered. It should calculate and return the total due by multiplying the price and quantity, adding an tax.
iii The third calculateTotal method takes three parameters, representing the price of an item, the quantity ordered, and a discount percentage. It should calculate and return the total due by multiplying the price and quantity, applying the discount percentage, adding an tax.
Write a main method to test all three overloaded calculateTotal methods
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started