/** * Programma che prende in input un voto e stampa un giudizio tra * Ottimo, Buono, Sufficiente e Insufficiente. Mostra come indentare * l'if multi-ramo in maniera più leggibile, pur facendo la stessa cosa * di P2Voto2. */ import java.util.Scanner; public class P3Voto3 { public static void main(String[] args) { System.out.print("Immetti voto in trentesimi (tra 0 e 30): "); Scanner tastiera = new Scanner(System.in); int voto = tastiera.nextInt(); if (voto >= 27 && voto <= 30) { System.out.println("Ottimo"); } else if (voto >= 21 && voto <= 26) { System.out.println("Buono"); } else if (voto >= 18 && voto <= 20) { System.out.println("Sufficiente"); } else { System.out.println("Insufficiente"); } tastiera.close(); } }