Question: Using C++ Create a class called Skateboard. Skateboard has 3 private member variables and 3 public member functions. Skateboard has the following 3 private member
Using C++ Create a class called Skateboard. Skateboard has 3 private member variables and 3 public member functions. Skateboard has the following 3 private member variables: 1) the brand of the skateboard (such as Sector9) 2) the model of the skateboard (such as HotSteppa) 3) the length of the skateboard in inches (such as 22)
Skateboard has the following 3 public member functions:
a member function named print which does not have any return value or input parameter. It should display to the screen all 3 member variables in the following way: brand: thebrand model: themodel length: the length
a member function named set which does not have any return value but has 3 input parameters which are 1) skateboard brand 2) skateboard model and 3) length of the skateboard. This function will set the value of each member variable with each parameter given. For example, consider the following code. Skateboard s; s.set(Sector 9, Hot Steppa, 22); The above line should set the three member variables values accordingly.
a member function named isLongBoard which returns true if the skateboard has a length of more than 28 inches. Otherwise, it returns false.
In the main function, create a vector of 2 Skateboards named skateboardCollection. Using a for loop and cin (NOT getline), ask the user to enter the brand, model, and length of each skateboard and populate each element in the vector using the set member function.
After that display all of the data in the vector via a well-designed loop using the print member function. Also display if the board is a longboard as determined by the isLongBoard function, like so:
a member function named print which does not have any return value or input parameter. It should display to the screen all 3 member variables in the following way: brand: thebrand model: themodel length: the_length longBoard: 0/1
Where the_brand is the value of brand, the_model is the value of model, and the_length is the value of length and 0/1 is the value of is long board (0 if false, 1 if true)
sample output for one skateboard:
brand: Sector9 model: HotSteppa length: 22 isLongBoard: 0
Example IO Sessions
Input:
Sector12 Stepper22 Jamboree Hurricane 30
Output:
brand: Sector12 model: Stepper length: 22 isLongBoard: 0 brand: Jamboree model: Hurricane length: 30 isLongBoard: 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
