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

#include <iostream> using namespace std; const int MAXFLOOR = 15; class Elevator

ID: 3617660 • Letter: #

Question

#include <iostream>

using namespace std;

const int MAXFLOOR = 15;

class Elevator

{

private:

int currentFloor;

public:

Elevator(int = 1);

void request(int);

};

Elevator::Elevator(intcfloor)

{

currentFloor = cfloor;

}

void Elevator::request(int newfloor)

{

if (newfloor < 1 || newfloor> MAXFLOOR || newfloor == currentFloor);

else if (newfloor >currentFloor)

{

cout << " Starting at floor" << currentFloor<<endl;

while (newfloor >currentFloor)

{

currentFloor++;

cout << " Going Up - now at floor" << currentFloor<<endl;

}

cout << "Stopping at floor" << currentFloor<<endl;

}

else

{

cout << " Starting at floor" << curretnFloor<<endl;

while (newfloor < curretFloor)

{

currentFloor--;

cout<< " Going Down - now at floor "<< currentFloor<<endl;

}

cout<< "Stopping at floor " << currentFloor<< endl;

}

return;

}

intmain()

{

Elevator a;

a.request(6);

a.request(3);

return 0;

}

Explanation / Answer

please rate - thanks #include using namespace std; const int MAXFLOOR = 15; class Elevator { private: int currentFloor; public: Elevator(int = 1); void request(int); }; Elevator::Elevator(int cfloor) { currentFloor = cfloor; } void Elevator::request(int newfloor) { if (newfloor < 1 || newfloor > MAXFLOOR || newfloor ==currentFloor); else if (newfloor > currentFloor) { cout