Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Objects;
- import java.util.Scanner;
- public class FuelTank {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String fuel = scanner.nextLine();
- double liters = Double.parseDouble(scanner.nextLine());
- if (Objects.equals(fuel, "Diesel")
- || Objects.equals(fuel, "Gasoline")
- || Objects.equals(fuel, "Gas")) {
- if (liters >= 25) {
- System.out.printf("You have enough %s.\n", fuel.toLowerCase());
- } else {
- System.out.printf("Fill your tank with %s!\n", fuel.toLowerCase());
- }
- } else {
- System.out.println("Invalid fuel!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement