Java Object Oriented design model 4/6 Invoice project, use, Product class

preview_player
Показать описание
When designing an object-oriented program, you need to discover classes. Classes correspond to nouns in the requirements specifications. In this problem, it is obvious what the nouns are:

Invoice, Address, Line Item, product, Description, Price, Qty, Total, Amount Due

Toaster, Hair Dryer and Car Vacuum are the objects of product class. Description ( Toaster) , and price (29.95) are the attributes of the Product class.

Qty ( quantity) is not an attribute of a Product. Class LineItem records the product and the Qty (quantity) of the product.

There are 3 LineItems objects. Each LineItem class includes a product class and quantity .

The total and amount due are computed - not stored anywhere. Thus , they don't lead to classes.

After this process of elimination, we are left with four candidate nouns for classes:
Рекомендации по теме