Question: why my code is not running? C++ #include busmanager.hpp #include bus.hpp #include #include using namespace std; BusManager::BusManager() { string s1, s2; int i1, i2; char

why my code is not running? C++

#include "busmanager.hpp"

#include "bus.hpp"

#include

#include

using namespace std;

BusManager::BusManager()

{

string s1, s2;

int i1, i2;

char c1;

int i = 0;

cout << "Please Enter Bus ID or 99999 to terminate: " << endl;

cin >> s1;

while (s1!= "99999")

{

cout <

cout << "Please enter your data for the Bus (busID,manufacturer,capacity,mileage,status is the order to be followed) ";

cin >> s1 >> s2 >> i1 >> i2 >> c1;

information[i] = new Bus(s1,s2, i1, i2, c1);

cout << "Enter bus ID or enter 99999 to quit: " << endl;

cin >> s1;

i = i + 1;

int bus_Num_ = 5;

void createObjects();

char ans;

do

{

information[i] = new Bus;

string s1, s2;

int i1, i2;

char c1;

information[i]->setBusID(s1);

information[i]->setManufacturer(s2);

information[i]->setCapacity(i1);

information[i]->setMileage(i2);

information[i]->setStatus(c1);

cout << "Enter Y to add more info ";

cin >> ans;

i++;

if (i == bus_Num_)//To check whether there is space left or not in the array.

{

cout << "Limit reached ";

break;

}

} while (ans == 'Y' || ans == 'y');

}

}

void BusManager::displayCH()

{

cout << left << setw(10) << "Bus Info"<< endl;

cout << left << setw(10) << "Bus ID "

<< setw(15) << "Manufacturer "

<< setw(20) << "Capacity "

<< setw(20) << "Mileage "<

cout << left<< setw(10) << "Status " << endl;

}

void BusManager::bus_Main()

{

string c;

while (c != "X" || c != "x")

{

if (c == "D" || c == "d")

{

bus_D();

}

else if (c == "L" || c == "l")

{

bus_L();

}

else if (c == "C" || c == "c")

{

bus_C();

}

else if (c == "O" || c == "o")

{

bus_O();

}

else if (c == "X" || c == "x")

{

cout << "Goodbye!" << endl;

break;

}

cout << "Please enter your transaction code (D=display, L=list a bus, C=change, O=order, X=exit)" << endl;

cin >> c;

}

}

void BusManager::bus_D()

{

const int num = 50;

int i;

displayCH();

for (i = 0; i < num; i++)

{

while (information[i] != NULL)

{

cout << "BusID : " << information[i]->getbusID() << endl;

cout << "Manufacturer : " << information[i]->getmanufacturer() << endl;

cout << "Capacity : " << information[i]->getcapacity() << endl;

cout << "Mileage : " << information[i]->getmileage() << endl;

cout << "Status : " << information[i]->getStatus() << endl;

cout << endl;

}

}

}

void BusManager::bus_L()

{

string s;

cout << "Please enter the Bus ID ";

cin >> s;

int i = 0;

while (information[i] != NULL)

{

if (information[i]->getbusID() == s)

{

cout << "Manufacturer : " << information[i]->getmanufacturer() << endl;

cout << "Capacity : " << information[i]->getcapacity() << endl;

cout << "Mileage : " << information[i]->getmileage() << endl;

cout << "Status : " << information[i]->getStatus() << endl;

cout << endl;

break;

}

i++;

}

if (information[i] == NULL)

{

cout << "Sorry! Not found ";

}

}

void BusManager::bus_C()

{

string s;

cout << "Please enter the Bus ID: ";

cin >> s;

int i = 0;

while (information[i] != NULL)

{

if (information[i]->getbusID() == s)

{

char c1;

cout << "Enter new status for the bus: ";

cin >> c1;

information[i]->setStatus(c1);

break;

}

i++;

}

if (information[i] == NULL)

{

cout << "Sorry! Not found ";

}

}

void BusManager::bus_O()

{

int i = 0;

string s1, s2;

int i1;

cout << "Please enter your data for the Bus (busID,manufacturer,capacity is the order to be followed) ";

cin >> s1 >> s2 >> i1;

information[i]->setBusID(s1);

information[i]->setManufacturer(s2);

information[i]->setCapacity(i1);

information[i]->setTransactionProcessor(s1, s2, i1);

cout << "Add Successful" << endl;

}

void BusManager::busManager_Cleanup()

{

int i;

for (i = 0; i < 50; i++)

{

delete information[i];

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!