Question: java Object Classes: designing Shopping Cart Shopping Cart , build a checkout system for a shop which sells items (i.e., products say Bread, Milk, and

java

Object Classes: designing Shopping Cart

Shopping Cart , build a checkout system for a shop which sells items (i.e., products say Bread, Milk, and Bananas). A shopping cart that can have multiples. Costs of the products are : Bread - $1, Milk - $0.60 and Banana - $0.40. A system should displays the order total.

The heart of a shopping cart can be represented in three classes: a cart class an order class, and an item class. Item objects are added to an array stored within the cart object.

java Object Classes: designing Shopping Cart Shopping Cart , build a checkout

Think first what are the nouns in the specification? (ex: Item) These are likely your Objects or possibly key data in an object

Which responsibilities belong to which nouns? These are likely to become their methods.

What are the relationships between nouns (Objects)? Draw it out that will help you visualize how they are interconnected

You will find that several Objects have a Has-a relationship An ItemOrder has an Item (one to one relationship) A ShoppingCart has many ItemOrders (one to many relationship)

system for a shop which sells items (i.e., products say Bread, Milk,

///////////////Output///////////

1.Buying Products In The Store 2.Display Cart 3.Finish

1

1.Name: Bread Price: 1.0 getBulkprice: 80.0 BulkQuantity: 100 Quqntity: 9

2.Name: Milk Price: 0.6 getBulkprice: 0.5 BulkQuantity: 50 Quqntity: 15

3.Name: Bananas Price: 0.4 getBulkprice: 0.2 BulkQuantity: 20 Quqntity: 20

a.Add to cary b.Remove From cart c.Go back

Item i double price ItemOrder io 2 int quantity String name 42 "String cheese" Item i double price ItemOrder io 2 int quantity String name 42 "String cheese

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!