Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a shopping cart application with the following properties: The store sells the following products with the given tags: Bread - Food Ice Cream -

Create a shopping cart application with the following properties:
The store sells the following products with the given tags:
Bread - Food
Ice Cream - Food, Desert, Milk
Lettuce - Food
Cupcake - Food, Desert
Cake - Food, Desert
Phone - Electronics
Watch - Electronics
Your shopping cart should use an ArrayList to store classes that implement a "Product" interface.
Your menu created/displayed in your main method, however, your main method should not use any print/println/printf calls.
Instead using the singleton pattern create a class that will handle all output. You can have the singleton class take a fully formed string that it will then print or you can create methods that will emulate print/println/printf
Products have a getSalePrice method
All products have a base price of $5.00
The tags have the following meaning:
Food sets price *0.75
Desert sets price *1.25
Milk sets price *1.15
Electronics sets price *2.25
Your program should provide the following menu options:
1) Author info
2) Add Bread
3) Add Ice Cream
4) Add Lettuce
5) Cupcake
6) Cake
7) Add Phone
8) Add Watch
9) Print prices
0) Exit
When a menu option from 2 through 8 is selected add a product (combination of decorators) to the products array list
When option 1 is selected print your name and id to the screen
When option 9 is selected print the name and sale price of all products that have been added.
Grading:
3 a serious attempt was made to complete the assignment
2 assignment uses the singleton pattern for printing
4 decorator pattern used to calculate prices
1 program compiles
-5 author info not printed correctly

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_2

Step: 3

blur-text-image_3

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

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions

Question

Is actinium (Z = 89) a transition element? Explain.

Answered: 1 week ago