1 Reply Latest reply on Apr 22, 2014 6:42 PM by jschellSomeoneStoleMyAlias

Here is the specification required for my assignment.

2. Specification

The University of Technical Systems (UTS) has just built new student housing and wants you to develop a system to put people in rooms and keep track of the money. The Tower is a single apartment block of 9 floors, with three apartments on each floor. The floors are numbered 1-9, so the apartments on the ground floor have numbers 101, 102, and 103. The Tower has the same layout on each floor; for floor 6 (say), the three rooms are

601: one bedroom 602: three bedrooms 603: two bedrooms

An apartment can house either all males, or all females; there are no mixed apartments. A male name ends in "o" and a female name ends in "a". A name ending in neither "o" nor "a" has an unspecified gender; an unspecified student gets the whole apartment, no matter how many bedrooms there are. UTS allocates bedrooms in a strict "first come first served" order, subject to the gender conditions; an example of the allocation process is shown in Appendix A.1. The allocated rooms are shown after all students have found a room.

A student can move to another apartment at the start of a month. The student enters their name and is given the first free bed, starting at apartment 101 bed 1, subject to the gender conditions; an example is shown in Appendix A.2. A student can also see who lives in an apartment by entering the apartment number; an example is shown in Appendix A.3.

The building manager tells the system that a month has ended by entering "t" (for time). The manager can also see all the students and their charges, sorted by student name. A single bedroom apartment costs \$2000 a month. A bedroom in a two-bedroom apartment costs \$1500 a month. A bedroom in a three-bedroom apartment costs \$1000 a month. An unspecified student pays for all the bedrooms in the apartment. Customer services cost another \$1000.11 per person. A GST of 10% is added to the total charge. An example of the output is shown in Appendix A.5.

The system retrieves data from file, if it exists. The menu uses the first input character:

• a: allocate an apartment
• m: move to another apartment
• s: see an apartment
• t: end a month (add time)
• c: show the student charges
• f: exit the menu and store to file
• ?: help

I am stuck where i have to allocate students into rooms. When I will enter the name the rooms should be assigned automatically. This is what i have done so far but its not correct as its not assigning the rooms automatically. Can anyone help please?

private void allocate(){

while(name!="x"){

System.out.print("Name: ");

name = In.nextLine();

if(name.equals("x")){

name = "x";

break;

}else if(name!="x"){

System.out.print("  "+"Room: ");

room = In.nextDouble();

}

}

}