0
  1. Define a class Car which:
     Stores the name, type, price, model year, number of color, and names of available colors
     Includes a default constructor.
     Includes a parameterized constructor.
     Group of available colors is allocated dynamically in the parameterized constructor based on received number of color.
     Includes a copy constructor.
     Includes a destructor.
     Includes set function for each data member.
     Includes get function for each data member
    o Get color function receives the index and return the corresponding color.
  2. Define Print function as a global function that receives car object and prints its information (Hint use get function).
  3. Write a main program by creating necessary objects. Ask the user to fill in the data and print objects information.
    ____________________________________________________________________
    i didn't understand this points "Get color function receives the index and return the corresponding color."
    and " Ask the user to fill in the data and print objects information." can someone please explain it to me ? :(
3
Contributors
2
Replies
21
Views
3 Years
Discussion Span
Last Post by tinstaafl
0

I think it means that you create an array of color names. The GetColor() function has an argument of the color number (index number) and returns the name of the color. For example

char *colors[] = {"Red","Yellow","Green","Brown","white","black"};

char* GetColor(int index) {return colors[index];}

This is just a guess - you should ask your instructor for clarification of that requirement.

Edited by Ancient Dragon

0

" Ask the user to fill in the data and print objects information."

This means you have to prompt the user to enter the information, then display that information to the screen after.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.