Assignment: C++ Programming
1. Read instructions carefully!
2. Use C++ syntax only, C syntax won't be allowed.
3. Always use braces to define blocks.
4. Organize your code well with proper formatting and a single statement per line.
5. Always insert a space before and after each operator, e.g. a = b + c; not a=b+c;
6. Use meaningful variable names following conventions using camelCasing. ?
7. Comment your code to clarify your thoughts if needed but do NOT comment every single line of code! ?
8. You may not use any library functions unless explicitly specified.
9. Name each program problem1.cpp, problem2.cpp, etc. and upload each file to Canvas.
10. Validate all input and re-prompt as long as an invalid value is entered! You don't need to validate the type.
Problem 1: Shopping Cart
Implement 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 variables 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 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. 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 pointers 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 currently in the cart to the console by calling each object's print() function.
Finally, implement a main function that creates a shopping cart object. Then add one item of each type to the shopping cart and finally list the items in the cart on the console.
Library: You need to include
Format your assignment according to the following formatting requirements:
1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.
2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.
3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.