Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 Shopping Cart 12 points Implement a program that tracks customers purchases. Create the following classes. Use appropriate access modifiers (instance variables should be

image text in transcribedimage text in transcribedProblem 1 Shopping Cart 12 points 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 a main function 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.image text in transcribed

Santa Monica College CS 52-C+Programming Assignment #5-00P/ Inheritance Points: 30 Instructions (3 points) 1. Write a commen at the top that contains the following information / cs s2 // Assignment #5 Properly indent, format and comment your code as necessary 2. Warning:-No late submission is accepted Points will be deducted for entirely commented files Name your files problem}.cpp, for example probleml.cpp, problem2.cpp, etc. Canvas may append-1, such as problem2-I.cpp which is akay Shopping Cart Implement a program that tracks custoeners' puarchases. Create the following classes. Use Problem1 12 points appropriate access modifers (instance variables should be private!) and data types for each. Don't Sorget to add getter and setter furctions. item: This class has the attrbutes [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 boueht, You may Emit the number of items in the cart. The cart should have functions to add an item and print the tems 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 shoppine cart object. . Finally, implement a nain function that creates a customer. Then add one item of each type to the customer's shopping cart and list the items in the cart on the console. Problem 2 Pizza 15 points Implement a program that creates pizzas based on user order. First, create class called Ingredient with one instance variable description of type sring which is set in the constructor and can be get using a getter function. Create the following classes that derive from Ingredient: TomatoSauce, Cheese, Dough, and Pepperoni; each with a constructor that passes the dercription argument to the base constructor. Use proper access modifiers

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

How will you measure it?

Answered: 1 week ago