Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; class Elevator { private: int elNum; // elevator number int currentFloor; // current floor int highestFloor; // highest floor public:

#include #include using namespace std;

class Elevator { private: int elNum; // elevator number int currentFloor; // current floor int highestFloor; // highest floor public: Elevator(int = 1, int = 1, int = 15); // constructor void request(int); }; //constructor function Elevator::Elevator(int e, int c, int h) { elNum = e; currentFloor = c; highestFloor = h; }

void Elevator::request(int) { int const maxFloor = 15;

if(int i<1 || i>15) { return; } else if(

Complete the following class by including functions corresponding to the two prototypes listed in the declaration section:

In this definition, the data member elNum is used to store the elevators number, the data member currentFloor is used to store the elevators current floor position, and the data member highestFloor is used to store the highest floor the elevator can reach. The constructor should allow initialization of an objects three data members with the data passed to the constructor when an Elevator object is instantiated. The request function should code the following algorithm: If a request is made for a nonexistent floor, a floor higher than the topmost floor, or the current floor Do nothing If the request is for a floor above the current floor Display the current floor number While not at the designated floor Increment the floor number Display the new floor number EndWhile Display the ending floor number Else // the request must be for a floor below the current floor Display the current floor number While not at the designated floor Decrement the floor number Display the new floor number EndWhile Display the ending floor number EndIf b. Include the class written for Exercise 3a in a complete program, and verify that all member functions work correctly

cant figure out the request function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is meant by the opportunity dimension of the AMO formula?

Answered: 1 week ago

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago