View the step-by-step solution to:


Question Descriptions

Question 1) Consider a billing system containing the following entities.


simple good, one that has price.

a good that is sold by weight, so its attributes are its weight (in kgs), and its price per kg.

a good that is stored in bunches. Its attributes are the number of units in the bunch (no partial

units are allowed) and the cost per unit.

All goods have a numeric UPC (Universal Product Code) and a name

Services can also be purchased.

a service that is charged at an hourly rate

a service that has a 

at fee

All services have a name and an description.

Both good and hourly rate services are taxable (

at fee services are not taxed), the rate depends

on the province where the business is taking place.

Province Code Goods Rate Hourly Services Rate

Alberta AB 3% 5%

Ontario ON 5% 6%

British Columbia BC 9% 9%

Quebec QC 8% 7%


All goods and services objects must have a method which gets the object's name, object's price

before tax, one which indicates whether the product is taxed and one which gives the price after



(a) Create a class hierarchy which can be used to respresent the system described. Use concepts

discussed in class to reduce code duplication, accurately model the system's data and to ensure

type safety. Create your class hierarchy in a UML class diagram using a UML-compliant tool.

Export the diagram from the tool and submit in pdf format.

(b) Implement your model in Java. Submit the set of source les generated. DO NOT zip

the les! Only the source is required. Do not submit bytecode or IDE project les.

(c) Write an application using the classes created below in an application class called Cashier

which can generate a bill of sale for a customer. Upon startup, the user provides the province

code where the store is located for taxation purposes. The following items can purchased.

garden hose (UPC code 0001), $4.99

grass seed (UPC code 0002), $0.35 per kg

nails (UPC code 0003), $.02 per nail....sold in packages of 50 or 90

lawn cutting service, $100

professional interlock laying $44 per hour

The program should ask the user to individually enter the item to be purchased and the quan-

tity of that item. Only the items above can be purchased. You can assume that a maximum

of 50 items can be in a transaction so there is no need to ask the user how many items they

are purchasing. All the items must be stored in a single array of size 50.

Once the user has entered all the items, then a bill of sale is printed to the console. It must

include the following data.

For each item purchased it should display the following item name, quantity purchased,

price before tax, price after tax. Each item should appear on a separate line

The nal line should have the total price.

Submit the source le generated


Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes