Advertisement
Spocoman

Summer Shopping

Sep 10th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 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.                 towel = Double.parseDouble(scanner.nextLine()),
  8.                 discount = Double.parseDouble(scanner.nextLine()),
  9.                 umbrella = towel / 3 * 2,
  10.                 flipFlops = umbrella * 0.75,
  11.                 beachBag = (towel + flipFlops) / 3,
  12.                 sum = (towel + umbrella + flipFlops + beachBag) * (100 - discount) / 100;
  13.  
  14.         System.out.printf("Annie's sum is %.2f lv. ", sum);
  15.         if (budget >= sum) {
  16.             System.out.printf("She has %.2f lv. left.", budget - sum);
  17.         } else {
  18.             System.out.printf("She needs %.2f lv. more.", sum - budget);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement