Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- public static void core(Hotel_Sys sys){
- Map<Integer, String> rooms = new HashMap<Integer, String>();
- Map<String, Reservation> reservations = new HashMap<String, Reservation>();
- Scanner input = new Scanner(System.in);
- String command;
- String user, password, rank;
- String beds,type; //type = "Casal" ou "Single"
- int roomNum=1;
- sys.createAccount("1", "admin", "Gestor");
- Account current = sys.accounts.get("1-admin");
- while(true){
- command = input.nextLine();
- switch(command){
- case "CA":
- if(current.rank != "Gestor"){
- System.out.println("Permission Denied");
- break;
- }
- //falta garantir que o user � int
- user = input.nextLine();
- password = input.nextLine();
- //verificar rank valido
- rank = input.nextLine();
- sys.createAccount(user, password, rank);
- System.out.println("Account created sucessfully");
- break;
- case "LI":
- user = input.nextLine();
- password = input.nextLine();
- current = sys.login(user, password);
- if(current == null){
- System.out.println("Login Failed!");
- break;
- }
- System.out.println("Logged In Sucessfuly!");
- break;
- case "CR": //create room
- if(current.rank=="Gestor" || current.rank=="Balcão"){
- beds = input.nextLine();
- type = input.nextLine();
- //caso os inputs sejam validos
- rooms.put(roomNum, "Livre"+" - " + type + " - Numero de camas : " + beds);
- roomNum++;
- System.out.println("Room aded!");
- break;
- }
- System.out.println("Permission Denied!");
- break;
- case "SR": //show rooms
- if(current.rank=="Gestor" || current.rank=="Balcão"){
- System.out.println("\nAll rooms: \n");
- for(int i = 1; i <= rooms.size(); i++){
- System.out.println(i + " + " + rooms.get(i));
- }
- break;
- }
- System.out.println("Permission Denied!");
- break;
- case "AR": //avaiable rooms
- if(current.rank=="Gestor" || current.rank=="Balcão"){
- System.out.println("\nAvaible rooms: \n");
- for(int i = 1; i <= rooms.size(); i++){
- if(rooms.get(i).charAt(0) == 'L'){
- System.out.println(i + " - " + rooms.get(i));
- }
- else{}
- }
- break;
- }
- System.out.println("Permission Denied!");
- break;
- case "MR": //fazer reserva
- case "DR": //apagar reserva
- default:
- System.out.println("No such command");
- }
- }
- }
- public static void main(String[] args) {
- Hotel_Sys sys = new Hotel_Sys();
- core(sys);
- Room_Checker teste = new Room_Checker();
- teste.AddRoom("Livre",1,"1", "Casal");
- teste.AddRoom("Livre",2,"1", "Single");
- teste.AddRoom("Livre",3,"2", "Casal");
- teste.OccupyRoom(2);
- teste.LeaveRoom(2);
- teste.ShowAll();
- teste.Available("Casal","1");
- Reservation reserva = new Reservation("2017/05/11 18:43","2017/05/11 18:47","Matinho",1,1);
- Reservation reserva2 = new Reservation ("2017/05/11 18:43","2017/05/11 18:47","Potato",2,2);
- Reservation reserva3 = new Reservation ("2017/05/11 18:43","2017/05/11 18:47","Bernas",3,3);
- System.out.println(reserva.reservations.get("Potato").clientName);
- //reserva.dateManager();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement