Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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)

image text in transcribed

Object Classes: designing Shopping Cart

image text in transcribed

////////////////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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

3031001257, 978-3031001253

More Books

Students also viewed these Databases questions

Question

=+57-2 Discuss some common misunderstandings about introversion.

Answered: 1 week ago

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago