Advertisement
Guest User

Untitled

a guest
Feb 20th, 2022
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1.         Scanner input = new Scanner(System.in);
  2.         int voto;
  3.         boolean registrare = false;
  4.         boolean esameSuperato = false;
  5.         System.out.println(" Un voto");
  6.         voto = input.nextInt();
  7.         if ((voto > 0) && (voto < 31)) {
  8.             if ((voto > 0) && (voto < 18)) {
  9.                 System.out.println("Esame non superato");
  10.             } else if ((voto > 17) && (voto < 25)) {
  11.                 esameSuperato = true;
  12.                 System.out.println("Giudizio sufficiente");
  13.                 System.out.println("Vuoi registrarlo? digita y per confermare, altrimenti premi un tasto qualsiasi");
  14.                 String risp = input.next();
  15.                 if (risp.equals("y")) {
  16.                     registrare = true;
  17.                 }
  18.  
  19.             } else if ((voto > 24) && (voto < 31)) {
  20.                 esameSuperato = true;
  21.                 System.out.println("Giudizio Buono");
  22.                 System.out.println("Vuoi registrarlo? digita y per confermare, altrimenti premi un tasto qualsiasi");
  23.                 String risp = input.next();
  24.                 if (risp.equals("y"))
  25.                     registrare = true;
  26.             }
  27.             if (esameSuperato)
  28.                 if (registrare)
  29.                     System.out.println("Voto Accettato");
  30.                 else
  31.                     System.out.println("Voto Rifiutato");
  32.         } else
  33.             System.out.println("Numero errato");
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement