computer science c++

profilefaatetak

 

mplement the class structure 

that represents a shopping cart 

for an online shop

and items that 

can be put in 

the shopping cart

.

Create the following classes

. Use appropriate access modifiers 

(

member

variables should be private!)

and data types for each. 

Don’t forget to add 

getter 

and 

setter functions

for each member variable.

Item

: This class has the 

member variable

s

called 

title

description

, and 

price

It has a 

pure 

virtual 

function 

called print 

(

void print() = 0;

)

that prints the type and description of 

the current object to the console. This function is NOT 

implemented in this class but 

must be implemented/overridden in the three subclasses below.

o

Book

:

This class inherit

s

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

It 

has 

a single

constructor which expects the maximum number of items that can be placed in the cart. 

It must 

have a dynamically allocated array of pointer

s

to an item object

(

Item

*

* array

;

)

which is initialized in the 

constructor

(

array =

new Item*[size]

).

The cart 

must have 

functions to add an item

object to the

cart 

and 

print 

the items c

urre

ntly in the cart to 

the console by calling each o

bject’s 

print

()

function.


can anyone do this assignment for me plagiarism  free in c++

  • 7 years ago
  • 20
Answer(2)

Purchase the answer to view it

blurred-text
NOT RATED

Purchase the answer to view it

blurred-text
NOT RATED