The theme for this project is provided by the Redding Elevator Company, which has been designing,
manufacturing and installing elevators in buildings worldwide for many decades.
All of the following programming exercises are to be implemented in MaSH, and should all have at least
a main() method. That means that programs that don’t use methods at all can not get full marks.
The exercises are not presented in any particular order. All exercises are independent. So if you have
difficulty with one, there is no reason why you can’t complete the rest.
Start work early. That way, if you get stuck, there are opportunities to ask questions, and you can
make the best use of the time in which you have access to robots.
Program 1 (nxt, 6 marks)
Despite elevators being fully automatic for many decades, maintenance technicians routinely require man-
ual control of them.
Write a program that enables the Elevator-NXT robot to be controlled manually using the NXT’s front
panel buttons (LEFT for door open, RIGHT for door close, ENTER for up, and ESCAPE for down), as
demonstrated in this video. The program should use the touch sensors to limit the motion of the car.
• Use button handlers to respond to both pressing and releasing the NXT’s front panel buttons.
Program 2 (nxt, 6 marks)
The installation and maintenance technicians need a program to calibrate and test the mechanical oper-
ation of an elevator.
Write the program that takes the Elevator-NXT through a calibration and test sequence, as shown in
To calibrate the elevator:
1. Raise the car as far as it goes to the top (the top floor).
2. Reset the rotation sensor.
3. Lower the car to the bottom (the bottom floor).
4. Record the rotation value. This value can be used to calculate the amount of rotation required to
get to the middle two floors.
To test the elevator, make it go to floors 2, 3, 1, and 0 in that order. At each floor open the doors,
wait for 1.5 seconds, and close the doors.
• Use time to control how long the motor runs when opening and closing the doors.
• This problem is much easier to write if you make good use of procedures. Write a procedure for
every basic action the elevator performs.
• The robot does not have to do more than one thing at a time. Threads are not necessary.
Program 3 (console, 6 marks)
The qualities that are most important to the Redding Elevator Company are safety and reliability. Both
are achieved by high standards of design, manufacture and service. All elevators are serviced regularly,
but even so, there will be unexpected failures. The long term goal is to minimise their frequency to
enhance the quality reputation of the products and the company.
Each elevator’s computerised controller maintains a log of the times it is put into service tup and the
times at which it fails tdown . This log is transmitted to the company to build a statistical profile of the
reliability of each elevator and, collectively, of each elevator model.
The main metric used to describe reliability is the mean time between failures (MTBF), the sum of all
of the failure times tdown minus the time it last came into service tup divided by the number or failures.
(tdown − tup )
number of failures
Write a program that can be used to read an extract from a log for one elevator and print the following
1. the total “uptime”, that is the total time the elevator was in service,
tdown − tup (in years);
2. the number of failures; and
there are 6 exercises like the one above that need to be completed. all the programs must be written in mash which is a derivative of java, much easier to to use. all the information for mash and how to use mash will be provided in detail, this has to be a custom set of code and cannot be divulged or sold to anyone else. some of the exercises must be written for a a toy robot elevator called the nxt, all information for this robot will be provided as well.
reply asap. thanks.