Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSI 3471: Item, Table, Chair and Room Classes in Java - Prof. Paul C. Grabow, Assignments of Software Engineering

The creation of various classes in java for an object-oriented design of a room with items. It includes an item class with unique, unchangeable names, subclasses table and chair, and a room class with unique names, doors, and an arraylist for storing items. The document also introduces a grid class for placing rooms within a two-dimensional grid.

Typology: Assignments

Pre 2010

Uploaded on 08/16/2009

koofers-user-sli
koofers-user-sli 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download CSI 3471: Item, Table, Chair and Room Classes in Java - Prof. Paul C. Grabow and more Assignments Software Engineering in PDF only on Docsity! CSI 3471 Example: Room with items 1. Define an Item class containing a single field, Name; assume that a. Name uniquely identifies an Item b. the Name is set when the Item object is created c. the Name may not be changed after the object is created d. a user can always determine the Name of an Item e. Item is Comparable 2. Define the following classes as subclasses of Item a. Table b. Chair 3. Define a Room class that a. has i. a unique name ii. two Doors, one on the north and the other on the south iii. an ArrayList called items that stores a collection of Item b. allows a user to place an Item into a given room i. an Item can be either a single Chair or a single Table ii. allow for the possible definition of other kinds of Item which could then be placed in the room c. assume i. both doors are closed when a Room object is created d. has a boolean addItem(Item anItem) method that i. adds anItem and returns true if it does not already exist in the Room ii. if anItem already exists, then addItem simply returns false e. has a boolean isIn(Item anItem) method that i. return true iff anItem is already in the room, otherwise it return false 4. Define a Grid class that allows someone to place rooms within the grid a. assume i. you can create a two-dimensional grid where the 1. horizontal dimension can be from 1 to 10, inclusive 2. vertical dimension can be either 1 or 2 ii. methods 1. boolean addRoom( int verticalIndex, int horizontalIndex, Room aRoom) 2. boolean isIn( Room aRoom )
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved