Hey everyone. Im just starting out in C++ and need a little bit of help on a project I am doing. I have the output / test cpp done already and most of the 'h' file.
I need help with the '.cpp' file and a look over of my 'h' file.
Instructions: Need to write a class definition and implement the member functions for class elevator with a constructor that places an elevator at a selected floor. Include a select member function that allows floors to be selected. For every floor, the message going up or going down should be displayed before the current floor.
Sample output that the book gave:
Start on floor 1
going up to 2
going up to 3
going up to 4
going up to 5
open at 5
going down to 4
doing down to 3
open at 3
Output / cpp file (I have already gone over this part with another classmate and this file is done)
1 2 3 4 5 6 7 8 9 10 11
// same as 8H.cpp
#include "elevator.h" // student work is in elevator, elevator.h and elevator.cpp
int main()
{
elevator aLift(1);
aLift.select(5);
aLift.select(3);
return 0;
}
Looks fine so far. Might be a little strange to call your object by the same name as a class member.
Since they want messages printed you could add another member for that purpose. The outputs all have a msg and a number so you could create a function like that too. A 'get_floor()' accessor would be useful for that msg.