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 ? :(

Recommended Answers

All 2 Replies

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.

" 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.