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

given below is a UML diagram of car parking. implement the class CarParking. The

ID: 3630035 • Letter: G

Question

given below is a UML diagram of car parking. implement the class CarParking. The program should perform the operation given the UML diagram.
NOTE: separate the ccp files and .h files definitions using header (.h) and cpp files.


Car Parking
-list :int

+is Emptylist() :bool
+is FullList() : bool
+ is Search() : void
+ Insert() : void
+ Remove() : void
+ PrintList() : void

Car Parking
-list :int

+is Emptylist() :bool
+is FullList() : bool
+ is Search() : void
+ Insert() : void
+ Remove() : void
+ PrintList() : void

Explanation / Answer

Implement the class CarParking given in the UML diagram.

Carparking.h is header file containing declaration of CarParking class. The file contents are:

Carparking.h

//File Carparking.h

#ifndef CARPARKING_H

#define CARPARKING_H

//Car class declaration

class CarParking

{

private:

     //variables

     int list;

public:

     //methods

     bool isEmptylist();

     bool isFullList();

     void isSearch();

     void Insert();

     void Remove();

     void PrintList();

}

#endif

Carparking.cpp is a file containing the definitions of the Carparking class member functions. The file contents are:

Carparking.cpp

//File Carparking.cpp

#include "Carparking.h"

//implementation of CarParking class methods

bool isEmptylist()

{

     //method statements

     return true;

}

bool isFullList()

{

     //method statements

     return true;

}

void isSearch()

{

     //method statements

}

void Insert()

{

     //method statements

}

void Remove()

{

     //method statements

}

void PrintList()

{

     //method statements

}

Car.cpp contains the application program that uses the class. The file contents are:

Car.cpp

#include <iostream>//I/O operations header file

#include "Carparking.h"//including Carparking header file

using namespace std;

void main()//main function

{

     //creating CarParking object

     CarParking car;

     bool flag;

     //calling methods of Carparking class

     flag = car.isEmptylist();

     flag = car.isFullList();

     car.isSearch();

     car.Insert();

     car.Remove();

     car.PrintList();

}//end of main