subject

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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
question
Computers and Technology, 24.06.2019 18:20
Use a while-end loop in a script file to calculate the sum of the first n terms of the series: summation sign on the top n bottom k=1 : )^k * k^2 +5k)/3^k show the script file and the two results of n = 10 and n = 20.
Answers: 2
question
Computers and Technology, 24.06.2019 23:00
Hypertension occurs when blood pressure is too high.
Answers: 1
question
Computers and Technology, 25.06.2019 00:40
Roger ginde is developing a program in supply chain management certification for managers. ginde has listed a number of activities that must be completed before a training program of this nature could be conducted. the activities, immediate predecessors, and times appear in the accompanying table: activity immediate predecessor(s) time (days) a -− 44b -− 55 c -− 11 d b 1010 e a, d 55 f c 55 g e, f 1010 calculate the slack time. show the details.
Answers: 2
You know the right answer?
1. define class elevator. for simplicity, we do not consider property like capacity (or weight limit...
Questions
question
Mathematics, 08.01.2021 19:50
question
Mathematics, 08.01.2021 19:50
question
French, 08.01.2021 19:50
question
Mathematics, 08.01.2021 19:50
question
Social Studies, 08.01.2021 19:50
question
Mathematics, 08.01.2021 19:50
Questions on the website: 13722363