Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help creating 2 classes (with headers and source files) with an inheriten

ID: 3589742 • Letter: I

Question

I need help creating 2 classes (with headers and source files) with an inheritence relationship in c++. The base class is Vehicle and the derived class is Car. The following pictures details how to set up the two classes. I'm suppose to test the classes against a test driver file(included here: https://docs.google.com/document/d/11uFW2jiVOcltd4bk6Wg5GFfRgHTWiwZsBWOkAPz9eZI/edit?usp=sharing). But honestly, you don't have to worry about that part if you don't have the time. I just want to see how to create the two classes. Thank you for your help!

memlbere hicle on the cath The Vehicle Class will contain the following protected data members: m_lla, a float array of size 3 which represents the location of the vehicle on the earth (LLA stands for longitude-Latitude-Altitude, which are the 3 values stored within the array). m_vin, a const int which represent a unique VIN - Vehicle Identification Number (no two vehicles can ever exist with the same m_vin) and the following private data members: s_idgen, a static int which is used by the class to generate a unique identifier to initialize m_vin whenever a new Vehicle object is instantiated - how can you achieve this behavior? (Hint Remember how you have been using static variables so far to keep track of the count of a class' active objects) and will have the following public methods: Default Constructor - will leave everything uninitialized (except m_vin which has to follow the above described specifications). When it gets called, it should produce a debug output: "Vehicle #vin: Default-ctor" (where vin the actual member value) Parameterized Constructor - will create a new object based on a desired value for the VIN ssed by-Value (it is however able to assign a different value if it runs into any danger of assigning conflicting values), and a desired set of values for LLA passed by-Address (a pointer to float data). When it gets called, it should produce a debug output: "Vehicle #vin: Parametrized-ctor" (where vin the actual member value) Copy Constructor - will create a new object based on the values of another Vehicle object (except m_vin which has to follow the above described specifications). When it gets called, it should produce a debug output: "Vehicle #vin: Copy-ctor" (where vin the actual member value) Destructor - called whenever an object gets destroyed. When it gets called, it should produce a debug output: "Vehicle #vin: Dtor" (where vin the actual member value).

Explanation / Answer

These both class having all member , member function and constructros , distroctor and overloded operators as you want. please go threw code and comments i mentioned.

class vehical
{  
   protected:    //protected members
       float m_lla[3];
       const int m_vin;
   private: // private members
       static int sidgen;
   public:
       vehical(); //Default constructur you can give defination out side
       vehical(const int x) ;// perameterised construct
       vehical(vehical &obj); //copy constrctor
        ~vehical()   //Distroctur
       {
           std::cout<<"Vehical "<<m_vin<<":Dtor "<<std::endl;
       }
      
       void operator = (const vehical &obj) // assignment operator
       {
           //change here what ever you want
           std::cout<<"Vehicle "<<obj.m_vin<<"Assignment"<<std::endl;
       }
       const int GetVehicalVin(void); //function for getting vihecal vin
       void SetLocation(float []); //function for setting location
       void MoveVehical(float []); // function for move methods
       int GetIdgen(void);   //GetIdget function
       void operator << (const vehical &obj); // incertion operator overloading
              
};


class car : vehical
{
   private:
       char m_plates[255];
       int m_throttle;
   public:
       car();
       car(char [] , int m_vin);
       car(car &obj)
       {
           std::cout<<"Vehical vin: "<<obj.m_vin<<std::endl;
       }
       ~car()   //Distroctur
       {
           std::cout<<"Vehical "<<m_vin<<":Dtor "<<std::endl;
       }
       void operator = (const car &obj) // assignment operator
       {
           //change here what ever you want
           std::cout<<"Vehicle "<<obj.m_vin<<"Assignment"<<std::endl;
       }
       int GetCarThrottle(void); //function for getting car throttle
       void SetCarPlates(char []); //function for setting m_plates
       void Drive(int); // Drive will take int throttle value
       void Move(float []); // function will take float array as an input_iterator
       void operator << (const car &obj); // incertion operator overloading  
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote