Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner input = new Scanner(System.in);
- int voto;
- boolean registrare = false;
- boolean esameSuperato = false;
- System.out.println(" Un voto");
- voto = input.nextInt();
- if ((voto > 0) && (voto < 31)) {
- if ((voto > 0) && (voto < 18)) {
- System.out.println("Esame non superato");
- } else if ((voto > 17) && (voto < 25)) {
- esameSuperato = true;
- System.out.println("Giudizio sufficiente");
- System.out.println("Vuoi registrarlo? digita y per confermare, altrimenti premi un tasto qualsiasi");
- String risp = input.next();
- if (risp.equals("y")) {
- registrare = true;
- }
- } else if ((voto > 24) && (voto < 31)) {
- esameSuperato = true;
- System.out.println("Giudizio Buono");
- System.out.println("Vuoi registrarlo? digita y per confermare, altrimenti premi un tasto qualsiasi");
- String risp = input.next();
- if (risp.equals("y"))
- registrare = true;
- }
- if (esameSuperato)
- if (registrare)
- System.out.println("Voto Accettato");
- else
- System.out.println("Voto Rifiutato");
- } else
- System.out.println("Numero errato");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement