Advertisement
MladenKarachanov

FuelTank

Jan 22nd, 2023
1,116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. package ProgrammingBasics2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class FuelTank{
  6.     public static void main(String[] args) {
  7.         Scanner scanner= new Scanner(System.in);
  8.  
  9.         String fuel=scanner.nextLine();
  10.         double num = Double.parseDouble(scanner.nextLine());
  11.  
  12.         if (fuel.equals("Diesel")|| fuel.equals("Gasoline")
  13.             || fuel.equals("Gas")){
  14.             if (num>=25){
  15.                 System.out.printf("You have enough %s.",fuel.toLowerCase());
  16.             }else{
  17.                 System.out.printf("Fill your tank with %s!",fuel.toLowerCase());
  18.             }
  19.         }else{
  20.             System.out.println("Invalid fuel!");
  21.  
  22.         }
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement