Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / TODO: Add the three Vehicle objects to the vector using the push _ back ( ) function / / TODO: Print out each

// TODO: Add the three Vehicle objects to the vector using the push_back() function
// TODO: Print out each Vehicle by looping through the vector and calling the Display() function for each Vehicle object
}21.2 Lab 2- Classes Part 1
The complete assignment description can be found on Canvas under the assignment "Lab 2"
Here you'll just implement the basic Vehicle class and its functions. The class declaration will be written in Vehicle.h, while the definitions of the functions will be written in Vehicle.cpp.
Tests 1 and 2 are set up for you; you just need to write the Vehicle class for those. For test 3, you will have to fill in the sections that are marked with a // TODO comment.
#include
#include
#include "Vehicle.h"
using namespace std;
int main()
{
int input;
cin >> input;
if (input ==1)
{
Vehicle defaultVehicle;
defaultVehicle.Display();
}
else if (input ==2)
{
Vehicle customVehicle1("Tesla", "Model S",2019,46122,42);
customVehicle1.Display();
Vehicle customVehicle2("Chrysler", "New Yorker", 1984,2000,100423);
customVehicle2.Display();
}
else if (input ==3)
{
Vehicle customVehicle1("Chrysler", "New Yorker", 1984,2000,100423);
Vehicle customVehicle2("COP3503", "Moped", 2019,2200,45);
cout << "Price of the vehicles: $"<< customVehicle1.GetPrice()+ customVehicle2.GetPrice()<< endl;
}
else if (input ==4)
{
Vehicle customVehicle1("Razor", "Scooter", 2019,39,950);
cout << customVehicle1.GetYearMakeModel();
}
else if (input ==5)
{
Vehicle muscleCar("Ford", "Mustang", 1968,82550,71000);
Vehicle electric("Toyota", "Prius", 2014,27377,12);
Vehicle suv("Mazda","CX5",2018,28449,11047);
vector vehicles;
// TODO: Add the three Vehicle objects to the vector using the push_back() function
// TODO: Print out each Vehicle by looping through the vector and calling the Display() function for each Vehicle object
}
return 0;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago