Engineering Programming Assessment
- Subject Code :
ENSE503
- University :
AUTI University Exam Question Bank is not sponsored or endorsed by this college or university.
- Country :
Australia
INSTRUCTIONS:
1. ACADEMIC INTEGRITY GUIDELINES
The following actions may be deemed to constitute a breach of the General Academic Regulations Part 7: Academic Discipline, Section 2 Dishonesty During Assessment or Course of Study
- 2.1.1 copies from, or inappropriately communicates with another person
- 2.1.3 plagiarises the work of another person without indicating that the work
is not the student's own – using the full work or partial work of another person without giving due credit to the original creator of that work - 2.1.4 Unauthorised collaboration in Assessment - collaborates with others in the preparation of material, except where this has been approved as an assessment requirement. This includes contract cheating where a student obtains services to produce or assist with an assessment
- 2.1.5 resubmits previously submitted work without prior approval of the exam board
- 2.1.6 Using any other unfair means
2. This is an individual assignment
- No collaboration is allowed. Don't show this assignment to others. Don't publish your assignment, assignment description, or solution on the internet.
- This assignment has been personalized to reduce unauthorized collaboration. Don't solve someone else's assignment.
3. The actual assignment is described on the following pages
Requirements
The assignment is to write a C/C++ program for the game Where is my key?
The aim of the game is to find your car key in one of the rooms of your house.
- The house has 6 rooms.
- Each room has a name. One of the rooms is named the entrance hall'. This is where you start.
- Every room has 3 doors to one other room each.
- Some doors are locked at first.
- The house layout, i.e. which room is connected to which other room by a door, is different every time the program runs.
At the start of the program:
- A startup message is printed.
- The elapsed time is set to zero.
- One room is selected to have the missing key (but it is not revealed to the user).
- The first turn starts.
Each turn proceeds as follows:
- The elapsed time is printed.
- The program prints the name of the room that you are in.
- The program prints the names of the three rooms you can go to (by using a door).
- The program lets the user enter an option. The options are:
- The user enters q. Then the program prints an end message and terminates.
- The user enters s. Then the elapsed time is incremented by a random number from 1 to 3. If the player is in the room with the keys, then the elapsed time is printed, followed by an end message, and the program terminates. Otherwise, a message is displayed that the key is not in the room, and the next turn starts.
- The user enters h. Then the program prints the name of the room with the key, the elapsed time is incremented by one, and the next turn starts.
- The user enters the name of a room. Then
- If the room is the same as where the player already is, then the elapsed time is incremented by two and the next turn starts.
- If the room is accessible via an unlocked door, then the elapsed time is incremented by one, and the player moves to the new room.
- If the door to the room is locked, then the program gives the option to unlock the door. If the player chooses to unlock the door, then the elapsed time is incremented by one and the door will be open in future turns. Either way, the player does not move to another room, yet, and a new turn starts.
- If the user input is not valid (e.g. no valid room name or no door to the room), then an error message is displayed and the next turn starts.