public static void main(String[] args) { if (args.length == 1) { host = args[0]; } Server server = connectToServer(); if (server == null) { logStandardConnectionError(null); System.out.println("L'applicazione verrà terminata."); return; } Scanner input = new Scanner(System.in); // Menù principale while (true) { System.out.println("== PHOENIX CAR SHARING ==\n\n1. Login\n\n2. Registrati\n\n3. Esci"); System.out.print("\n> "); int selection = input.nextInt(); switch (selection) { case 1: // Login System.out.println("\n\n== PHOENIX CAR SHARING: Login ==\n\n"); System.out.print("Username: "******"\nPassword: "******"\n\nERRORE: lo username o la password inseriti non sono corretti. Ricontrolla i dati e riprova."); } catch (UnexistingUserException e) { System.out.println( "\n\nERRORE: non è stato trovato nessun utente con questo username."); } waitForEnterKey(); break; case 2: // Registrazione System.out.println("\n\n== PHOENIX CAR SHARING: Registrazione ==\n\n"); System.out.print("Username: "******"\nPassword: "******"\nEmail: "); String email = input.next(); System.out.print("\nNome: "); String name = input.next(); System.out.print("\nCognome: "); String surname = input.next(); Client client1; try { client1 = new PhoenixClient(server, username1, password1, email, name, surname); client1.register(); System.out.println( "OPERAZIONE CONCLUSA CON SUCCESSO: l'utente è ora registrato a Phoenix Car Sharing."); } catch (RemoteException e) { logStandardConnectionError(e); } catch (UserAlreadyRegisteredException e) { System.out.println( "\n\nERRORE: lo username o l'email inseriti risultano già registrati. Controlla i dati e riprova."); } finally { client1 = null; } waitForEnterKey(); break; case 3: // Esci System.out.println("A presto!"); input.close(); return; default: System.out.println("Opzione non disponibile. Inserisci un numero compreso tra 1 e 3."); break; } } }