Question
All done in C++ format thank you Elevator.h File #ifndef ELEVATOR_H #define ELEVATOR_H class Elevator { public: //constructor: Elevator(int initFloor); //post: receives initial floor you
All done in C++ format thank you
Elevator.h File
#ifndef ELEVATOR_H #define ELEVATOR_H class Elevator { public: //constructor: Elevator(int initFloor); //post: receives initial floor you are starting at. // set private var currentFloor // cout something like: "starting on floor " + currentFloor //public method(s) void select(int target); //post: receives the target floor you wish to get to // if current floor > target floor (going up) // create a loop from currentFloor to target floor++ // cout something like "going up to " + number in loop // else if current floor < target floor (going down) // create a loop from currentFloor to target floor-- // cout "something like going down to " + number in loop // cout something like open at + currentFloor //private vars private: int currentFloor; //tracks current floor }; #endif
File 8F_ ElevatorTestDriver.cpp (
//Student Name //8.3 ElevatorTestDriver.cpp //this program will take the elevator class out for a test drive! #include "Elevator.h" #include// for cout, cin, system("pause") using namespace std; // so I don't have to say iostream::cout int main() { cout << "Student Name, CIS127, Assignment 2.1" << endl; Elevator elevator(1); elevator.select(5); elevator.select(3); system("pause"); } /* paste output here!!! */
Files you will be submitting: Elevator.cpp with output Notes: Remember to add your information to output and copy and paste output to the bottom of the main program Points: 10
General Directions:
I have attached the Elevator.h and 8F_ElevatorTestDriver.cpp file above.
The ElevatorTestDriver creates a new object of Elevator class starting on floor 1(using the constructor). It then takes a trip to the 5th floor and then returns to the 3rd floor. Along the way it prints out all kinds of nice stuff (See results at bottom).
Your job is to take the .h file and create Elevator.cpp from it.
Start out by copying the files above into your project directory. Add 8F_ElevatorTextDriver.cpp to your source files. Open it up and right-click Elevator.h and select open Elevator.h so you can view it.
Create a new source file called Elevator.cpp. - include "Elevator.h" as well as
Results:
Student Name, CIS127, Assignment 8.3 Start on floor 1 Going up to floor 2 Going up to floor 3 Going up to floor 4 Going up to floor 5 Open at floor 5 Going down to floor 4 Going down to floor 3 Open at floor 3
Press any key to continue . . .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started