Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class maiwnOWO {
  4.  
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner Scan = new Scanner(System.in);
  8.         boolean ripeti = true;
  9.         double Carburante;
  10.         Motorino owo = new Motorino();
  11.         while(ripeti)
  12.         {
  13.             int request = Scan.nextInt();
  14.             switch(request)     //1 = Accendi; 2 = Spegni; 3 = Accelera; 4 = Frena; 5 = Carburante
  15.             {
  16.             case 1:
  17.                 owo.Accendi();
  18.                 break;
  19.             case 2:
  20.                 owo.Spegni();
  21.                 break;
  22.             case 3:
  23.                 System.out.println(owo.Accelera());
  24.                 System.out.println(owo.getVelocita());
  25.                 System.out.println(owo.getCarburante());
  26.                 break;
  27.             case 4:
  28.                 System.out.println(owo.Frena());
  29.                 System.out.println(owo.getVelocita());
  30.                 break;
  31.             case 5:
  32.                 System.out.println(owo.getCarburante());
  33.                 System.out.println(owo.getCapacitaSerbatoio());
  34.                 System.out.println("Inserire carburante da rifornire");
  35.                 Carburante = Scan.nextDouble();
  36.                 owo.Rifornisci(Carburante);
  37.                 break;
  38.             default:
  39.                 ripeti = false;
  40.                
  41.             }
  42.         }
  43.        
  44.  
  45.     }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement