Description

Feel Free to pick anything you like and can meet all the requirements. Please make sure all the points are covered. Thanks


Part 1 Description (25 points)

Think of your favorite type object in the whole wide world and create a C++ class that represents that object. Use singular, and generic name for the class such as Car, Food, Bike, Coffee, etc.

  1. Create a C++ class named after your object. (This class should not have a main function )
  2. Create at least 3 private instance fields (attributes) for your class, using different data types for each field. (5 points)
  3. Create getter (accessor) and setter (mutator) function for each of your fields. (5 points)
  4. Create a function called display(), that simply prints out the values of all instance variables of your object. This function will have no parameters and not return a value. (5 points)
  5. Create a default constructor (no parameters) that assigns all your instance variables to default values, that you specify. (5 points)
  6. Create a parameterized constructor that takes all instance variables as parameters, and sets the instance variables to the values provided by the parameters. (5 points)

Part 2 Description (40 points)

Using your code for Part 1 above:

  1. Create a sub class that extends your base class. (For example, if Car is the base class then SportsCar could be your sub class) (5 points)
  2. Provide at least one additional instance field to your subclass, along with a getter and setter function for the new field. (5 points)
  3. Create a default constructor for the subclass. It should set all attributes in the subclass as well as the base class to default values. (5 points)
  4. Create a parameterized constructor for the subclass, that passes inherited parameters to the base class. It should set all attributes in the subclass as well as the base class to the values that are passed in to the constructor. (5 points)
  5. Override the display() function to print out all the instance variable values from the base class, and also from the sub class. (5 points)
  6. Create a template function of your choice (10 points)
  7. Write comments for all your code. (5 points)

Part 3 Description (35 points)

Testing your program

  1. Create an instance (object) of your base class by using the default constructor. Call the appropriate setter functions to set the object’s data. (5 points)
  2. Create an instance of your base class using the parameterized constructor. (5 points)
  3. Create an instance of your subclass using the default constructor. Call the appropriate setter functions to set the object’s data. (5 points)
  4. Create an instance of your subclass using the parameterized constructor. (5 points)
  5. Call the display() function for each object. (10 points)
  6. Write code to display the use of your generic template function. (5 points)