Comp 152 Project 3:
Inheritance, interfaces and enumerations
Due: Sat Oct 23rd at 11:59pm
Due: Tues Oct 26th at 11:59pm
Summary:
In this project we will build on the previous project adding inheritance,
interfaces and enumerations. We will add the ability to make an order and
calculate the total cost including MA sales tax if applicable.
Details:
Use the UML class diagram below and write the classes shown. Descriptions
of what each method does are found below the diagram
You may add any private 'helper functions'
that you want to add to this diagram, you just have to have these
methods which do what is listed below, but if you break them down and
call private methods to make your design cleaner that is great.
- Order Class: Update the order class
- add a private instance variable called cartForOrder which will be an
arraylist of merchandiseItem
- add a parameter in the constructor which is an arraylist of
merchandiseItem, use this to initialize the cartForOrder variable
- MerchandiseItem Class
- make a new class with the three instance variables you see in the
diagram
- the three getXXX methods are just accessors that should return the
values of the instance variables
- the constructor just takes in values and uses them to initialize the
instance variables.
- ItemType is an enum with the three values you see.
- Customer Class:
- add three new methods to the Customer class
- arrangeDelivery will just print, the Customer Name and then
"deliver any time" in the Customer class.
- payOutstandingBalance should return 0.0 in the customer class
- PayForOrder must be an abstract method
without any implementation
- BusinessCustomer class:
- extends Customer
- has one instance variable called purchaseOrderBalance or type double
- PayForOrder method should
- print that this order will be for this customer name and it will
be payed with a purchase order
- sum up the cost of all of the items in the order
- add any of the taxes required
- add this total to the the purchaseOrderBalance instance variable
- return 0
- payOutstandingBalance should
- check the outstanding balance, if it is over $1000 then apply a 5%
bulk discount
- return the current value of outstanding balance minus any discount
- reset the outstanding balance to zero
- arrangeDelivery should
- print to the screen mentioning the name (from customer) and that
all deliveries must be from 9-5 Mon-Fri
- Residential Customer:
- PayForOrder
- sum up the cost of all of the items in the order
- add any of the taxes required
- return the sum of the item cost and taxes
- TaxExemptCustomer
- PayForOrder
- sum up the value of all of the items in the order
- return that value
- arrangeDelivery
- print please contact <name from customer> on the day of
delivery
- Store Class:
- before starting the user interaction menu read in a text file full
of merchandiseItem values and create a list of merchandise item
objects that the store sells, Store these in the new Stock variable
- adjust the makeOrder function
- it should now allow the customer to select several items for
purchase
- after the order is complete, call PayForOrder and arrangeDelivery
on the customer and add the return value to the new revenue instance
variable
- add another option to the runStore menu to collect all outstanding
balances from all customers - add these values to revenue
Have fun and learn a lot. This will take
some time, but each piece is fairly straightforward.
Additional Requirements:
- continue to use your projec2 project on
github
- be sure to include your name in the
project name somewhere.
- Comment your code well enough that I know you know what you wrote.
- use Massachusetts tax rules for retail
- the tax rate for general merchandise is 6.25%
- the tax on WIC eligible food is 0%
- the tax rate on clothing is 0% if the item is less than or equal to
$175
- if the clothing is more than $175, then the sales tax is 6.25% on
the difference between the price and 175, so a $200 article of
clothing would have 6.25% tax on $25 of the price.
Submission:
submit by sharing your project with me on github like last time.