import java.text.*;
import java.util.*;
public class University_Apartment
{
public static void main (String[]arguments)
{
String studentName, studentID, passportNumber, currentDate, assignDate, currentHour, apartmentType1, apartmentType2;
String userInputMain, userInputI, userInputR, userInputView;
String userChoiceFullA, userChoiceFullB;
char optionMain, optionInputI,optionInputR, optionInputView;
char optionChoiceFullA, optionChoiceFullB;
int indexHouseA,indexHouseB;
int houseNumber, roomNumber;
final int roomA = 2;
final int roomB = 3;
boolean next = false;
boolean nextA = false;
boolean nextB = false;
int[] HouseA1 = new int[roomA];
int[] HouseA2 = new int[roomA];
int[] HouseA3 = new int[roomA];
int[] HouseA4 = new int[roomA];
int[] HouseA5 = new int[roomA];
int[] HouseB1 = new int[roomB];
int[] HouseB2 = new int[roomB];
int[] HouseB3 = new int[roomB];
int[] HouseB4 = new int[roomB];
int[] HouseB5 = new int[roomB];
Scanner keyboard = new Scanner (System.in);
do {
System.out.println();
System.out.println("************************************");
System.out.println("****** Fortes Fortuna Apartment ****");
System.out.println("*==================================*");
System.out.println("* MAIN MENU *");
System.out.println("*==================================*");
System.out.println("* I => Apartment Info *");
System.out.println("* R => Register New Student *");
System.out.println("* V => View Occupancy *");
System.out.println("* S => Search Student *");
System.out.println("* Q => Quit *");
System.out.println("* *");
System.out.println("*==================================*");
System.out.println();
System.out.print ("Enter : ");
userInputMain = keyboard.nextLine();
optionMain = userInputMain.charAt(0);
switch(optionMain)
{
case 'i' : case 'I':
System.out.println();
System.out.println("#=======================================#");
System.out.println("# APARTMENT INFORMATION #");
System.out.println("#=======================================#");
System.out.println("# #");
System.out.println("# A => Info Apartment A #");
System.out.println("# B => Info Apartment B #");
System.out.println("# M => return to Main Menu #");
System.out.println("# #");
System.out.println("#=======================================#");
System.out.print ("Enter : ");
userInputI = keyboard.nextLine();
optionInputI = userInputI.charAt(0);
if(optionInputI == 'm' || optionInputI == 'M') {
System.out.println();
System.out.println("Back to Main Menu.");
System.out.println();
}
else if(optionInputI == 'a' || optionInputI == 'A') {
System.out.println();
System.out.println(":::::::::::::::::::::::::::::::::::::::::::::::::::");
System.out.println(":::: Apartment Type A ::::");
System.out.println("::===============================================::");
System.out.println(":: * 2 bedrooms ::");
System.out.println(":: * Equipped with kitchen & laundry facilities ::");
System.out.println(":: * Monthly rental = RM300. ::");
System.out.println(":: ::");
System.out.println(":::::::::::::::::::::::::::::::::::::::::::::::::::");
}
else if (optionInputI == 'b' || optionInputI == 'B') {
System.out.println();
System.out.println(":::::::::::::::::::::::::::::::::::::::::::::::::::");
System.out.println(":::: Apartment Type B ::::");
System.out.println(":::::::::::::::::::::::::::::::::::::::::::::::::::");
System.out.println(":: 2 normal bedrooms & 1 master bedroom ::");
System.out.println(":: Without kitchen and laundry ::");
System.out.println(":: Monthly rental = RM200 ::");
System.out.println("___________________________________________________");
System.out.println(" * Master bedroom attached with inside bathroom ");
System.out.println(" ** People who live in master bedroom ");
System.out.println(" will be paying 40% more = RM280 ");
System.out.println("___________________________________________________");
System.out.println();
}
break;
case 'r': case 'R':
DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date current = new Date();
DateFormat time = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.ENGLISH);
currentHour = time.format( current );
Calendar today = Calendar.getInstance();
currentDate = sdf.format(today.getTime());
today.add(Calendar.DATE,140);
assignDate = sdf.format(today.getTime());
System.out.println();
System.out.println(" Register New Student");
System.out.println("---------------------------------");
System.out.println("Enter your name : ");
studentName = keyboard.nextLine();
System.out.println();
System.out.println("Enter your Full Student ID (ex: TP123456): ");
studentID = keyboard.nextLine();
System.out.println();
System.out.println("Enter your Full Passport Number(include the Letter): ");
passportNumber = keyboard.nextLine();
System.out.println();
System.out.println("Which apartment type you want? (A/B)");
userInputI = keyboard.nextLine();
optionInputI = userInputI.charAt(0);
System.out.println();
if(optionInputI == 'a' || optionInputI == 'A') {
apartmentType1 = "Apartment Type A";
System.out.println("Which house do you want?");
System.out.println("#. House");
System.out.println("1 A1 ");
System.out.println("2 A2 ");
System.out.println("3 A3 ");
System.out.println("4 A4 ");
System.out.println("5 A5 ");
houseNumber = keyboard.nextInt();
switch(houseNumber) {
case '1' :
for (indexHouseA = 0; indexHouseA <=HouseA1.length; indexHouseA++) {
if (indexHouseA == 2) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseA1[indexHouseA] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2)");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseA1[roomNumber-1] == 0 ) {
HouseA1 [roomNumber-1] += 1;
nextA = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType1+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextA = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '2' :
for (indexHouseA = 0; indexHouseA <=HouseA2.length; indexHouseA++) {
if (indexHouseA == 2) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseA2[indexHouseA] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2)");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseA2[roomNumber-1] == 0 ) {
HouseA2 [roomNumber-1] += 1;
nextA = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType1+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextA = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '3':
for (indexHouseA = 0; indexHouseA <=HouseA3.length; indexHouseA++) {
if (indexHouseA == 2) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseA3[indexHouseA] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2)");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseA3[roomNumber-1] == 0 ) {
HouseA3 [roomNumber-1] += 1;
nextA = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType1+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextA = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '4':
for (indexHouseA = 0; indexHouseA <=HouseA4.length; indexHouseA++) {
if (indexHouseA == 2) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseA4[indexHouseA] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2)");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseA4[roomNumber-1] == 0 ) {
HouseA4 [roomNumber-1] += 1;
nextA = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType1+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextA = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '5':
for (indexHouseA = 0; indexHouseA <=HouseA5.length; indexHouseA++) {
if (indexHouseA == 2) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseA5[indexHouseA] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2)");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseA5[roomNumber-1] == 0 ) {
HouseA5 [roomNumber-1] += 1;
nextA = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType1+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextA = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
}break;
}
else if(optionInputI == 'b' || optionInputI == 'B') {
apartmentType2 = "Apartment Type B";
System.out.println("Which house do you want?");
System.out.println("#. House");
System.out.println("1 B1 ");
System.out.println("2 B2 ");
System.out.println("3 B3 ");
System.out.println("4 B4 ");
System.out.println("5 B5 ");
houseNumber = keyboard.nextInt();
switch(houseNumber) {
case '1' :
for (indexHouseB = 0; indexHouseB <=HouseB1.length; indexHouseB++) {
if (indexHouseB == 3) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseB1[indexHouseB] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2/3)");
System.out.println(" *note = 3 is Master Bedroom");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseB1[roomNumber-1] == 0 ) {
HouseB1 [roomNumber-1] += 1;
nextB = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType2+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextB = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '2' :
for (indexHouseB = 0; indexHouseB <=HouseB2.length; indexHouseB++) {
if (indexHouseB == 3) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseB2[indexHouseB] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2/3)");
System.out.println(" *note = 3 is Master Bedroom");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseB2[roomNumber-1] == 0 ) {
HouseB2 [roomNumber-1] += 1;
nextB = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType2+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextB = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '3' :
for (indexHouseB = 0; indexHouseB <=HouseB3.length; indexHouseB++) {
if (indexHouseB == 3) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseB3[indexHouseB] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2/3)");
System.out.println(" *note = 3 is Master Bedroom");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseB3[roomNumber-1] == 0 ) {
HouseB3 [roomNumber-1] += 1;
nextB = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType2+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextB = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '4' :
for (indexHouseB = 0; indexHouseB <=HouseB4.length; indexHouseB++) {
if (indexHouseB == 3) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseB4[indexHouseB] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2/3)");
System.out.println(" *note = 3 is Master Bedroom");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseB4[roomNumber-1] == 0 ) {
HouseB4 [roomNumber-1] += 1;
nextB = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType2+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextB = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
case '5' :
for (indexHouseB = 0; indexHouseB <=HouseB5.length; indexHouseB++) {
if (indexHouseB == 3) {
System.out.println();
System.out.println("Sorry, this house is full.");
System.out.println("Please look for another house");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}break;
}
else if (HouseB5[indexHouseB] < 1){
System.out.println();
System.out.println("Which room do you want? (1/2/3)");
System.out.println(" *note = 3 is Master Bedroom");
roomNumber = keyboard.nextInt();
if (roomNumber == 1){
if (HouseB5[roomNumber-1] == 0 ) {
HouseB5 [roomNumber-1] += 1;
nextB = true;
System.out.println("Thanks, your room is in room number "+roomNumber+", house "+houseNumber+" "+
"on "+apartmentType2+".");
System.out.println("Please pay all the administration fees.");
System.out.println("You will be assigned till "+ assignDate +".");
}
}
else {
nextB = false;
System.out.println();
System.out.println();
System.out.println("Sorry, this room is already booked");
System.out.println("Please look for another room");
System.out.println(" M - Back to Main Menu");
System.out.println(" Q - Quit ");
userChoiceFullA = keyboard.nextLine();
optionChoiceFullA = userChoiceFullA.charAt(0);
if (optionChoiceFullA == 'm' || optionChoiceFullA == 'M'){
System.out.println();
System.out.println("Main Menu.");
}
else if (optionChoiceFullA == 'q' || optionChoiceFullA == 'Q'){
System.exit(0);
}
}break;
}break;
}break;
}break;
}
else {
next = false;
System.out.println();
System.out.println("Wrong type, Back to Main Menu");
System.out.println();
}break;
case 'v' : case 'V':
System.out.println();
System.out.println(" VIEW ROOM OCCUPANCY ");
System.out.println("---------------------------------");
System.out.println("A - for Apartment A");
System.out.println("B - for Apartment B");
System.out.println("M - to return to Main Menu");
System.out.print("Enter : ");
userInputI = keyboard.nextLine();
optionInputI = userInputI.charAt(0);
if(optionInputI == 'M' || optionInputI == 'm') {
System.out.println();
System.out.println("Back to Main Menu.");
System.out.println();
}
else if(optionInputI == 'A' || optionInputI == 'a') {
System.out.println();
System.out.print("Please choose a house number: (1 - 5)");
userInputView = keyboard.nextLine();
optionInputView = userInputView.charAt(0);
switch (optionInputView){
case '1' :
System.out.println();
System.out.println("************************************");
System.out.println("* Apartment A (House 1) *");
System.out.println("************************************");
System.out.print("*");
for(indexHouseA = 0; indexHouseA < HouseA1.length; indexHouseA++){
System.out.print(" " + HouseA1[indexHouseA]);
if(indexHouseA == 2){
System.out.print(" ");
System.out.println();
System.out.println("********************************************");
if(indexHouseA == 2){
System.out.println();
}
}
}System.out.println();
System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '2' :
System.out.println();
System.out.println("************************************");
System.out.println("* Apartment A (House 2) *");
System.out.println("************************************");
System.out.print("*");
for(indexHouseA = 0; indexHouseA < HouseA2.length; indexHouseA++){
System.out.print(" " + HouseA2[indexHouseA]);
if(indexHouseA == 2){
System.out.print(" ");
System.out.println();
System.out.println("********************************************");
if(indexHouseA == 2){
System.out.println();
}
}
}System.out.println();
System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '3' :
System.out.println();
System.out.println("************************************");
System.out.println("* Apartment A (House 3) *");
System.out.println("************************************");
System.out.print("*");
for(indexHouseA = 0; indexHouseA < HouseA3.length; indexHouseA++){
System.out.print(" " + HouseA3[indexHouseA]);
if(indexHouseA == 2){
System.out.print(" ");
System.out.println();
System.out.println("********************************************");
if(indexHouseA == 2){
System.out.println();
}
}
}System.out.println();
System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '4' :
System.out.println();
System.out.println("************************************");
System.out.println("* Apartment A (House 4) *");
System.out.println("************************************");
System.out.print("*");
for(indexHouseA = 0; indexHouseA < HouseA4.length; indexHouseA++){
System.out.print(" " + HouseA4[indexHouseA]);
if(indexHouseA == 2){
System.out.print(" ");
System.out.println();
System.out.println("********************************************");
if(indexHouseA == 2){
System.out.println();
}
}
}System.out.println();
System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '5' :
System.out.println();
System.out.println("************************************");
System.out.println("* Apartment A (House 5) *");
System.out.println("************************************");
System.out.print("*");
for(indexHouseA = 0; indexHouseA < HouseA5.length; indexHouseA++){
System.out.print(" " + HouseA5[indexHouseA]);
if(indexHouseA == 2){
System.out.print(" ");
System.out.println();
System.out.println("********************************************");
if(indexHouseA == 2){
System.out.println();
}
}
}System.out.println();
System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
}break;
}
else if(optionInputI == 'b' || optionInputI == 'B') {
System.out.println();
System.out.print("Please choose a house number: (1 - 5)");
userInputView = keyboard.nextLine();
optionInputView = userInputView.charAt(0);
switch (optionInputView){
case '1' :
System.out.println();
System.out.println("*************************************");
System.out.println("* Apartment B (House 1) *");
System.out.println("*************************************");
System.out.print("*");
for(indexHouseB = 0; indexHouseB < HouseB1.length; indexHouseB++){
System.out.print(" " + HouseB1[indexHouseB]);
if(indexHouseB == 3){
System.out.print(" *");
System.out.println();
System.out.println("*****************************************");
System.out.println();
}
}System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '2' :
System.out.println();
System.out.println("*************************************");
System.out.println("* Apartment B (House 2) *");
System.out.println("*************************************");
System.out.print("*");
for(indexHouseB = 0; indexHouseB < HouseB2.length; indexHouseB++){
System.out.print(" " + HouseB2[indexHouseB]);
if(indexHouseB == 3){
System.out.print(" *");
System.out.println();
System.out.println("*****************************************");
System.out.println();
}
}
System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '3' :
System.out.println();
System.out.println("*************************************");
System.out.println("* Apartment B (House 3) *");
System.out.println("*************************************");
System.out.print("*");
for(indexHouseB = 0; indexHouseB < HouseB3.length; indexHouseB++){
System.out.print(" " + HouseB3[indexHouseB]);
if(indexHouseB == 3){
System.out.print(" *");
System.out.println();
System.out.println("*****************************************");
System.out.println();
}
}System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '4' :
System.out.println();
System.out.println("*************************************");
System.out.println("* Apartment B (House 4) *");
System.out.println("*************************************");
System.out.print("*");
for(indexHouseB = 0; indexHouseB < HouseB4.length; indexHouseB++){
System.out.print(" " + HouseB4[indexHouseB]);
if(indexHouseB == 3){
System.out.print(" *");
System.out.println();
System.out.println("*****************************************");
System.out.println();
}
}System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
case '5' :
System.out.println();
System.out.println("*************************************");
System.out.println("* Apartment B (House 5) *");
System.out.println("*************************************");
System.out.print("*");
for(indexHouseB = 0; indexHouseB < HouseB5.length; indexHouseB++){
System.out.print(" " + HouseB5[indexHouseB]);
if(indexHouseB == 3){
System.out.print(" *");
System.out.println();
System.out.println("*****************************************");
System.out.println();
}
}System.out.println();
System.out.println("HINT : ");
System.out.println("[ 0 => available ]");
System.out.println("[ 1 => reserved ]");
break;
}break;
}
else {
next = false;
System.out.println();
System.out.println("Wrong type, Back to Main Menu");
System.out.println();
}break;
case 's' : case 'S' :
System.out.println();
System.out.println("Insert Full Student ID number (ex: TP123456");
System.out.println();
case 'q' : case 'Q' :
System.out.println();
System.out.println("You quit the system");
System.exit(0);
break;
default :
System.out.println();
System.out.println("Wrong type, back to Main Menu.");
break;
}
}while( optionMain != 'q' || optionMain != 'Q');
}
}