Computers and Technology

1. define class elevator. for simplicity, we do not consider property like capacity (or weight limit), door (open or close), or status (running, maintenance, alarm). (a) data members of an elevator can be as follows, they are all ints. currentfloor, basefloor, and topfloor; (b) define constructors for elevator class. a default constructor setting basefloor to be 1, and topfloor to be 6, and currentfloor to be1. define an non-default constructor public elevator(int currentfloor, int basefloor, int topfloor), where topfloor should be at least 2, basefloor should be smaller than topfloor, and currentfloor is somewhere between basefloor and topfloor. (c) define method up with a given parameter numfloors (an int). if numfloors is positive, then move that many floors up from the currentfloor, update value for currentfloor. note that after you run this method, currentfloor cannot be bigger than topfloor.(d) define method down with a given parameter numfloors (an int). if numfloors is positive, then move that many floors down from the currentfloor, update value for currentfloor. note that after you run this method, currentfloor cannot be smaller than the basefloor.(e) define a getter for each data member. (f) no need to define other method.2. define passenger class. it takes data members: currentfloor and targetfloor. both are ints.(a) define constructor of passengers. this constructor takes two int parameters, use them to initialize the corresponding data member.(b) define a getter for each data member.(c) no need to define other methods.3. define class passengerstakeelevator. (a) define data member as an elevator and a list of passengers (read api of arraylist). the main difference between an array and a list is that a list can grow (add an element to the list) or shrink (remove an element from the list) dynamically; however, to access an individual element, we need to start from the head of the list.(b) define a default constructor, use an elevator created from a default constructor, and build a list of three passenger. for each passenger, currentfloor and targetfloor are random ints between the basefloor and topfloor of the elevator. note that for each passenger, currentfloor cannot be the same as targetfloor (otherwise, there is no need to move the passenger using ) define a non-default constructor that takes an elevator and a list of passengers.(c) define method schedule. let the elevator serve passengers in the first-in and first-out order. for simplicity, you can assume that2 there is only one elevator, and the elevator can only carry one passenger a time. for each passenger, we first need to move the elevator to the current floor of that passenger if the elevator is not in that floor yet. then bring the passenger to his/her target floor. print out a message every time the elevator movesfor example, passenger 0 is at fl 5, will go to fl 2 elevator is at fl 1 elevator moves up from fl 1 to fl 5 elevator carries passenger down from fl 5 to fl 24. define a client class to test passengerstakeelevator. a sample output may look like: a. passenger 0 is at fl 5, will go to fl 2 elevator is at fl 1 elevator moves up from fl 1 to fl 5 elevator carries passenger down from fl 5 to fl 2b. passenger 1 is at fl 3, will go to fl 2 elevator is at fl 2 elevator moves up from fl 2 to fl 3 elevator carries passenger down from fl 3 to fl 2c. passenger 2 is at fl 4, will go to fl 3 elevator is at fl 2 elevator moves up from fl 2 to fl 4 elevator carries passenger down from fl 4 to fl 3

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, icantspeakengles
Aconstruction company is creating a powerpoint presentation describing how they calculate costs during each construction step. they plan to email this presentation to clients. the individual clients will be watching the presentation slide show on their own personal computers. what is the most important formatting step the company should take to make the text readable and pleasing to the eye?
Answers: 2
image
Computers and Technology, 22.06.2019 18:00, crimhill
When is it appropriate to use an absolute reference
Answers: 1
image
Computers and Technology, 22.06.2019 19:20, bob4059
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_cost should be removed since header files should not contain constants. c)the definition of book should be removed since header files should not contain class definitions. d)the body of the calculate_terms function should be added to the header file.
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, tbt81
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
Do you know the correct answer?
1. define class elevator. for simplicity, we do not consider property like capacity (or weight limit...

Questions in other subjects:

Konu
Mathematics, 16.10.2020 08:01
Konu
Mathematics, 16.10.2020 08:01
Konu
Engineering, 16.10.2020 08:01
Konu
Social Studies, 16.10.2020 08:01