September 09, 2010, 01:44:02 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Arrays & Instances  (Read 878 times)
0 Members and 1 Guest are viewing this topic.
anshi
Junior Member
*

Reputation: 0
Offline Offline
Posts: 1
Referrals: 0

Awards
« on: March 11, 2009, 10:02:38 AM »

Hi Friends..

Please help me with your valuable answers..

Merlion hotel has enlisted your company help to revamp an existing application.
It has 28 rooms which are numbered 0 to 27. when a guest checks in, the following
information has to be recorded: the guest's name, the date of arrival, and the
expected number of days the guest will stay.

1. Under the existing system, in order to organise the instances of Guest in order of
room number, an array with 28 elements is used. That is, at any given time, the array
element with subscript 0 will hold the record for any guest staying in room 0, and so
on. Each element in the array may either be null(if the room is empty) or an instance
of Guest(if the room is occupied).

Hotel Merlions sister hotel, Hotel Singa, with identical booking procedures but with rooms numbered 1 to 28 wishes to use the same computerised booking system

Explain whether the same array can be used for Hotel Singa, without renaming or renumbering the rooms in some way, (if you think a change must be made, suggest a simple new system that still uses an array to hold the information. Any changes should not make the system any more complicated to operate than that of Hotel Merlion.)

2. The management of Hotel Merlion decides to increase the size of the hotel (i.e., the number of rooms), drop the old numbering system, and rename each room after letters of the alphabet, starting with ‘A’ to ‘Z’. The room after room ‘Z’ is to be room ‘AA’, then room ‘BB’ etc., up to ‘ZZ’.

Under the existing system, it was easy to look up an individual room by room number and find out details of the current occupant (if any).

Suggest (with justification) a collection class, other than Array, of which an instance could be used to hold the instances of Guest and facilitate the use of the new alphabetic room labels to look up guests.

Thanks in advance..
Anshi

Logged
Javaforums.net :: a community about Java software development.
« on: March 11, 2009, 10:02:38 AM »

 Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #1 on: March 11, 2009, 03:42:00 PM »

What have you done so far? any code you can show so we know where you are stuck at?
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Javaforums.net :: a community about Java software development.
   

Your Ad Here
 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.216 seconds with 33 queries.

Google visited last this page September 06, 2010, 12:48:47 PM