📄 roomcontroller.java
字号:
import java.util.*;
import java.io.*;
public class RoomController
{
public static void main(String[] args) throws IOException
{
// declaration of variables used in the main method
Block jBlock = new Block("J Block");
char choice;
String aName;
String aRoomNumber = "";
choice = displayMenu();
while (!(choice == 'E' || choice == 'e'))
{
switch (choice)
{
case '1':
{
// display rooms
// your code in here
}// end of case 1
break;
case '2':
{
// add new member of staff to a room
// your code in here
}// end of case 2
break;
case '3':
{
// move a member of staff from one room to another
}// end of case 3
break;
case '4':
{
// remove a staff member from a room
// your code in here
}
break;
case '5':
{
// add a new room to the system
// your code in here
}
break;
case '6':
{
// remove a room from the system
// your code in here
}
break;
case '7':
{
// list occupants of a room
// your code in here
}
break;
case '8':
{
// find room number of a member of staff
}// end of case 8
break;
case '9':
{
// list rooms with vacant space
// your code in here
}// end of case 9
break;
default:
{
UserInput.print("You have made an incorrect choice");
}// end of default
break;
}// end of switch
choice = displayMenu();
}//end of while (!(choice == 'E' || choice == 'e'))
//
// jBlock.saveRoomDetails();
System.out.println("That's all folks");
System.exit(0);
}
private static char displayMenu()
{
char option;
UserInput.prompt("1 Display room and occupants" +
"\n2 Add person to room" +
"\n3 Move person from one room to another" +
"\n4 Remove person from a room" +
"\n5 Add a room" +
"\n6 Remove a room" +
"\n7 List people in room" +
"\n8 Find room number of person" +
"\n9 List rooms with vacant space" +
"\nE Exit" +
"\n\nPlease input your choice");
option = UserInput.readChar();
return option;
}//end of displayMenu method
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -