Question
JAVA I want to read the quantity of the scanner, and It has elements Bread - $1, Milk - $0.60 and Banana - $0.40 ,and
JAVA
I want to read the quantity of the scanner, and It has elements Bread - $1, Milk - $0.60 and Banana - $0.40 ,and Commitment UML and image and If the quantity is reached stand
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.
Object Classes: designing Shopping Cart
Object Classes: designing Shopping Cart
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
Object Classes: designing Shopping Cart
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)
Object Classes: designing Shopping Cart
////////////////Output///////////
1.Buying Products In The Store
2.Display Cart
-1.Finish
1
1.Name: Bread Price: 1.0 getBulkprice: 9.0 BulkQuantity: 100
2.Name: Milk Price: 0.6 getBulkprice: 8.0 BulkQuantity: 50
3.Name: Bananas Price: 0.4 getBulkprice: 1.0 BulkQuantity: 20
1.Add to cary
2.Remove From cart
3.Exit
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started