Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine()),
- towel = Double.parseDouble(scanner.nextLine()),
- discount = Double.parseDouble(scanner.nextLine()),
- umbrella = towel / 3 * 2,
- flipFlops = umbrella * 0.75,
- beachBag = (towel + flipFlops) / 3,
- sum = (towel + umbrella + flipFlops + beachBag) * (100 - discount) / 100;
- System.out.printf("Annie's sum is %.2f lv. ", sum);
- if (budget >= sum) {
- System.out.printf("She has %.2f lv. left.", budget - sum);
- } else {
- System.out.printf("She needs %.2f lv. more.", sum - budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement