Your school is organising an open evening event where prospective parents will be able to visit the different classrooms and departments to get to find out more about the school and meet with the teachers. Parents have been given a list of rooms and activities going on during this open evening. The school will use students leaders to help guide the parents between the different buildings. The school would also like to develop an App for parents to use on their phones to help them locate a room. They would like this app to:
- Let the parent enter the name of a room (e.g. Sports Hall) or its room code (e.g. A205).
- The App should indicate in which building this room is located and on what floor it is.
The school consists of 5 main buildings: The A Block, the B Block, the C Block, a 6th Form Block and a Sports Hall.
The A, B and C blocks have three floors. Each classroom within these blocks is given a code such as A205. The first letter of this code is referring to the building (e.g. A for A Block).
The number is based on which floor the room is on:
- Classrooms with a number lower than 100 are on the ground floor. (e.g. A15, B7, C23)
- Classrooms with a number between 100 and 199 are located on the first floor. (e.g. A101, B120, C119)
- Classrooms with a number of 200 and above are located on the second floor. (e.g. A205, B220, C231)
The Sixth Form block only contains two floors: the ground floor and the first floor. Classrooms in the 6th form block have a code starting with letter S.
- Classrooms with a number lower than 20 are on the ground floor. (e.g. S4, S15)
- Classrooms with a number of 20 and above are located on the first floor (e.g. S20, S27)
Other rooms of the school (other than classrooms) do not have a specific code. They include the Main Reception, the Dance Studio, the Activity Studio, the Sports Hall, the Staffroom and the Canteen. These are spread around the school site within the different blocks. Specific instructions on where these are located also need to be provided by the App.
Your Task
Last year, the head of school asked one of the Computer Science GCSE students to produce the code for this App. Initially, the app was not meant to cater for the 6th From block as it was not used for the open evening. This year however, the 6th form block will be accessible by parents. The student who created the App has now passed his GCSE and left the school. We therefore need you to look at their code and complete the code to make sure that it does provide instructions to locate classrooms from the 6th form block.
A new Coffee Bar has also been created on the first floor of the C block. You will need to amend the code to also include directions to the Coffee Bar.
We have also realised an issue with the code. If a parent enters a room code for a building that does not exists (e.g. D102) the app should tell them that this room does not exist. This is not the case currently. Can you fix this code to make sure only valid room codes starting with A, B, C or S or valid room names are used.
Test Plan
To make sure your app is fully working as expected, you will have to make sure that it passes the following 10 tests!
Test # | Input Values | Expected Output | Pass or Fail? |
#1 | A205 | This room is located in the A Block. It is on the second floor. | |
#2 | B14 | This room is located in the B Block. It is on the ground floor. | |
#3 | C101 | This room is located in the C Block. It is on the first floor. | |
#4 | S12 | This room is located in the 6th Form Block. It is on the ground floor. | |
#5 | S22 | This room is located in the 6th Form Block. It is on the first floor. | |
#6 | D102 | We cannot locate this room! Are you sure this is a valid room? | |
#7 | Main Reception | This room is located at the main entrance of the A block. | |
#8 | Sports Hall | This room is located on the side of the B Block. | |
#9 | Coffee Bar | This room is located on the first floor of the C block. | |
#10 | Swimming Pool | We cannot locate this room! Are you sure this is a valid room? |
Python Code
Here is the Python code for the App so far…
Extension Task
Adapt this whole code to make it work for your school. Find out how room codes are used and tweak the code accordingly.
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area