Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM (please be sure youre answering in the correct language) Please anwser the following Java problem. Also add a picture of the sample output.

JAVA PROGRAM (please be sure youre answering in the correct language)

Please anwser the following Java problem. Also add a picture of the sample output.

Implement a program that tracks customers purchases. Create the following classes. Use appropriate access modifiers (instance variables should be private!) and data types for each. Dont forget to add getter and setter functions.

Item: This class has the attributes (member variables) called title, description, and price.

o Book: This class inherits from Item. It has an instance variable called pageCount.

o Movie: This class inherits from Item. It has an instance variable called length. o CD: This class inherits from Item. It has an instance variable called trackCount.

ShoppingCart: This class keeps track of items that were bought. You may limit the number of items in the cart. The cart should have functions to add an item and print the items currently in the cart to the console.

Customer: The customer class stores an id, the first name and the last name and a pointer to a shopping cart object.

Finally, implement amainfunction that creates a customer. Then add one item of each type to the customers shopping cart and list the items in the cart on the console.

Add methods/API that allows you to remove an item from the cart.

Please comment on everything youre doing so that I understand what each line is doing!! Thank you please show output as well.

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions