c++代写 | 代做 c | assignment – CS 52 c++ Programming

CS 52 c++ Programming

c++代写 | 代做 c | assignment – 这是利用 c 进行训练的代写, 对 c 的流程进行训练解析, 涵盖了c++/ c 等方面, 这个项目是assignment代写的代写题目

ass代做 assignment代写 代写assignment

CS 52 c++ Programming

1

C++ Programming Programming assignment 5 Instructions:

**1. Read instructions carefully! **

  1. Use C++ syntax only, c syntax wont be allowed.
  2. Always use braces to define blocks.
  3. Organize your code well with proper formatting and a single statement per line.
  4. Always insert a space before and after each operator, e.g. a = b + c; not a=b+c;
  5. Use meaningful variable names following conventions using camelCasing.
  6. Comment your code to clarify your thoughts if needed but do NOT comment every single line of code!
  7. You may not use any library functions unless explicitly specified.
  8. Name each program problem1.cpp, problem2.cpp, etc. and upload each file to Canvas.
  9. Validate all input and re-prompt as long as an invalid value is entered! You dont need to validate the type.

Plagiarism : Plagiarism of any kind will not be tolerated! Plagiarized assignments will be reported to the Campus Disciplinarian.

Problem 1 Shopping Cart 30 points 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. Dont 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 objects print() function.

Finally, implement a main function that creates a shopping cart object. Then add one item of

Santa Monica College CS 52 C++ Programming

2

each type to the shopping cart and finally list the items in the cart on the console.

Library: You need to include