100% Guaranteed Results


PCS – 1.
$ 24.99
Category:

Description

5/5 – (1 vote)

2. Create an OrderForm class (which will have main) Create an order class which you will instantiate one in orderForm, the order should have things an order would have, name, an instance of your last HW’s Address class (or create a Customer class, that uses your Address class) and an array of Items. The Item class should have things associated to an order item like name, description and price
3. Populate your order with items.
4. Write print methods for Order and Item
5. Add a getTotal() method in Order that calculates the total cost of the order, looping through the Item array and getting their prices and adding them together.
6. Add this total into the Order class’s print method
7. Use the OrderForm’s class main method to create an order and print it

———–This we will do in class, only do if you want to————-

8. Add a field/instance (variable) to the Item class to indicate if the item is taxable (bool)
9. Add a method to Order that calculates the tax on the order
HINT: Add a static variable for tax rate, based on which item is taxable calculate the tax. (forloop the items, check their isTaxable(), if yes, multiply by tax rate and add to tax total, return total tax)

10. Change our getTotal() method in Order to include the tax. Maybe create a getSubTotal() to do what our getTotal() method did previously.
11. Fix the print methods in Item and Order to reflect this new taxable field/variable

Reviews

There are no reviews yet.

Be the first to review “PCS – 1.”

Your email address will not be published. Required fields are marked *

Related products