Answer the given question with a proper explanation and step-by-step solution. Instructions Create a VS C++ project using the name format: firstname_lastname_06 The program will ask for values (int, double, string, or any datatype that's in your class' attributes) to initialize an array of 5 objects of your Assignment 1's class. Note: If you received feedback about Assignment 1 design, update it accordingly. Then, sort the list using the insertion sort algorithm and display the content of the list. Make sure to modify the insertion sort algorithm from your textbook to work with an array of your Assignment 1's class. Your class may also need to be modified by implementing a few operator overloading functions. Submission Files to submit: Project/solution-related files Your class (.h and .cpp) main file (.cpp) Submit the project in a zip folder. Assignment 1 Car.h #pragma once #include using namespace std; class Car { private:    int maxSpeed; //maximum speed of the car    string model; //model of the car    double price; //price of the car public:    Car();    Car(string mdl, int m, double p);    int getMaxSpeed();    void setMaxSpeed(int m);    string getModel();    void setModel(string mdl);    double getPrice();    void setPrice(double p);    void display();    //destructor    ~Car(); }; Assignment 1 Car.cpp #include #include "Car.h" using namespace std; Car::Car() {    //default values of Car object    model = "No defined";    maxSpeed = 80;    price = 10000; } //parameterized constructor Car::Car(string mdl, int m, double p) {    //applying business rule for maxSpeed    if (m > 0 && m < 130)        maxSpeed = m;    else        maxSpeed = 80;    model = mdl;    price = p; } //accessor and mutator int Car::getMaxSpeed() {    return maxSpeed; } void Car::setMaxSpeed(int m) {    //applying business rule for maxSpeed    if (m > 0 && m < 130)        maxSpeed = m;    else        maxSpeed = 80; } string Car::getModel() {    return model; } void Car::setModel(string mdl) {    model = mdl; } double Car::getPrice() {    return price; } void Car::setPrice(double p) {    price = p; } Car::~Car() {    cout << "An Car object has been removed from memory." << endl; } void Car::display() {    cout << "Model: " << model << ", maxspeed = " << maxSpeed << ", price = " << price << endl; } Assignment 1 Comments/mistake was Missing const modifier for accessors. Please Modify both file .h and .cpp and create the main file.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Answer the given question with a proper explanation and step-by-step solution.

Instructions

Create a VS C++ project using the name format:

firstname_lastname_06

The program will ask for values (int, double, string, or any datatype that's in your class' attributes) to initialize an array of 5 objects of your Assignment 1's class.

Note: If you received feedback about Assignment 1 design, update it accordingly.

Then, sort the list using the insertion sort algorithm and display the content of the list.

Make sure to modify the insertion sort algorithm from your textbook to work with an array of your Assignment 1's class.

Your class may also need to be modified by implementing a few operator overloading functions.

Submission

Files to submit:

Project/solution-related files

Your class (.h and .cpp)

main file (.cpp)

Submit the project in a zip folder.

Assignment 1 Car.h

#pragma once
#include <iostream>

using namespace std;
class Car

{
private:
   int maxSpeed; //maximum speed of the car
   string model; //model of the car
   double price; //price of the car

public:
   Car();
   Car(string mdl, int m, double p);

   int getMaxSpeed();
   void setMaxSpeed(int m);
   string getModel();

   void setModel(string mdl);
   double getPrice();
   void setPrice(double p);
   void display();

   //destructor
   ~Car();
};

Assignment 1 Car.cpp

#include <iostream>
#include "Car.h"

using namespace std;
Car::Car()
{
   //default values of Car object
   model = "No defined";
   maxSpeed = 80;
   price = 10000;
}

//parameterized constructor
Car::Car(string mdl, int m, double p)
{
   //applying business rule for maxSpeed
   if (m > 0 && m < 130)
       maxSpeed = m;

   else
       maxSpeed = 80;

   model = mdl;
   price = p;
}

//accessor and mutator
int Car::getMaxSpeed()
{
   return maxSpeed;
}

void Car::setMaxSpeed(int m)
{
   //applying business rule for maxSpeed

   if (m > 0 && m < 130)
       maxSpeed = m;

   else
       maxSpeed = 80;
}

string Car::getModel()
{
   return model;
}

void Car::setModel(string mdl)
{
   model = mdl;
}

double Car::getPrice()
{
   return price;
}

void Car::setPrice(double p)
{
   price = p;
}

Car::~Car()
{
   cout << "An Car object has been removed from memory." << endl;
}

void Car::display()
{
   cout << "Model: " << model << ", maxspeed = " << maxSpeed << ", price = " << price << endl;
}

Assignment 1 Comments/mistake was Missing const modifier for accessors.

Please Modify both file .h and .cpp and create the main file. Thank you!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education