Lesson 1.2 · Write it
Door messages
A whole programPython or Java1 test
A lift shows three messages, one after another. Write a program that prints exactly these three lines, in this order:
Going up. Next stop: floor 4. Mind the doors.
- Each message is on its own line, and the lines come in the order shown.
- Everything is checked exactly: capitals, spaces, the colon and the full stops. Spaces at the end of a line are ignored.
- Print nothing else.
The program reads no input. In Python, write one instruction for each line. In Java, the page starts you with a class and its main method: write your instructions between the braces of main, and print with System.out.println.
Running Java here comes later. You can still write your Java answer (it stays while this page is open) and compare it with our worked solution. Or try this exercise in Python.
Examples
Your program is run once, as in the example below. Only what it prints is checked.
the three lines, in order (rules 1 to 3)
You type
Nothing
It prints
Going up. Next stop: floor 4. Mind the doors.
solution.pySolution.java