Coding Exercise: 2-D Arrays

Test your understanding of multi-dimensional arrays.

We'll cover the following

Problem

This exercise uses a 2-D array to check the occupancy of hotel rooms.

Write a console-based app called Hotel that meets the requirements listed below.

  1. Create a 2-D array for two floors and three rooms.
  2. Add the following data in the created 2-D array.
  • Floor 1: Andrew M., Zach T., Devin D.
  • Floor 2: Ramona P., Robert C, Empty
  1. Display the queried floor, the room checked, and the occupant of the room.

Sample input

The program accepts two int parameters, for example:

0, 1

Expected output

The finished output of the program should look like the example below:

Floor 0 Room 1 occupancy: Zach T.

Get hands-on with 1200+ tech skills courses.