Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- /*Algoritmo Voti
- INIZIO
- PER i DA 0 A numeroVoti-1
- leggi(voto)
- SE voto < 6
- ALLORA
- testo = "negativo"
- ALTRIMENTI
- SE voto == 6
- ALLORA
- testo = "sufficiente"
- ALTRIMENTI
- testo = "positivo"
- scrivi(testo)
- FINE*/
- class Voti{
- public static void main(String args[]){
- int i;
- int numeroVoti;
- int voto;
- InputStreamReader input = new InputStreamReader(System.in);
- BufferedReader tastiera = new BufferedReader(input);
- try{
- System.out.println("Quanti voti bisogna esaminare?");
- String nVoto = tastiera.readLine();
- numeroVoti = Integer.valueOf(nVoto).intValue();
- for(i=1; i <= (numeroVoti); i++){
- try{
- System.out.println("Quali sono?");
- String votoLetto = tastiera.readLine();
- voto = Integer.valueOf(votoLetto).intValue();
- }
- catch(Exception e){
- System.out.println("Questo non e' un voto");
- i--;
- continue;
- }
- if (voto < 6){
- System.out.println("NEGATIVO");
- }
- else if (voto == 6){
- System.out.println("SUFFICIENTE");
- }
- else{
- System.out.println("POSITIVO");
- }
- }
- }
- catch(Exception e){
- System.out.println("Questo non e' un voto");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement