Advertisement
Spocoman

Safari

Sep 9th, 2024
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double budget = Double.parseDouble(scanner.nextLine()),
  7.                 fuel = Double.parseDouble(scanner.nextLine()),
  8.                 sum = 2.10 * fuel + 100;
  9.         String day = scanner.nextLine();
  10.  
  11.         if (day.equals("Saturday")) {
  12.             sum *= 0.90;
  13.         } else {
  14.             sum *= 0.80;
  15.         }
  16.  
  17.         if (budget >= sum) {
  18.             System.out.printf("Safari time! Money left: %.2f lv.\n", budget - sum);
  19.         } else {
  20.             System.out.printf("Not enough money! Money needed: %.2f lv.\n", sum - budget);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement