INFO I211 Lab 6: Arrays

Due date: see Oncourse Modules or Assignments
50 points

Learning Objectives

  1. Develop proficiency in arrays.
  2. Reinforce skills of writing classes, loops, and conditionals.

Instructions

Summary

  1. Write a Floor class, representing a floor or storey in a building. A Floor is characterized by its two horizontal dimensions (width and depth—we assume it is a rectangle) and number of rooms. Your class should include a constructor and methods to retrieve the width, depth, number of rooms, and area of the floor.

  2. Write a Building class, representing a multi-storey building. The building must have a field which is an array of Floors. Your class should include a constructor, and methods to compute the total number of rooms, the total area, and the minimum and maximum number of rooms on a floor.

Follow the Coding Standards through Chapter 8, Arrays.

Specifications

Floor Class

These are the required methods. I am leaving the method names up to your choice, so remember to follow the guidelines for good style in naming. There is no need to define setters for the fields, since these characteristics rarely change, once a floor is built. You may, however, define additional methods if you wish.

Building Class

These are the required methods. I am leaving most of the method names up to your choice, so remember to follow the guidelines for good style in naming. There is no need to define a setter or getter for the field. You may, however, define additional methods if you wish.

Table 1: Floors for Testing
Width Breadth No. of rooms Remarks
100 200 16 Ground floor
100 200 12 1st floor
100 200 10 2nd floor
80 160 12 3rd floor
60 140 10 Top floor

What to Turn in

Through Oncourse Assignments, turn in the Java source file(s) and captured output of running the test (i.e., main method of the Building class), either as a screenshot, or a text file with extension .txt.

Grading Criteria

__ of 10 points. Correctness of Floor class

__ of 40 points. Correctness of Building class

__ of 5 points. Program style, Coding Standards through Ch. 8

__ of 5 points. Program testing, as instructed

__ of 50 points total