Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ASD {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double tshirtPrice = Double.parseDouble(scanner.nextLine());
- double average = Double.parseDouble(scanner.nextLine());
- double shortsPrice = tshirtPrice * 0.75;
- double socksPrice = shortsPrice * 0.20;
- double shoesPrice = (tshirtPrice + shortsPrice) * 2;
- double totalSum = tshirtPrice + shortsPrice + socksPrice + shoesPrice;
- double discount = totalSum - (totalSum * 0.15);
- double moreMoney = Math.abs(discount - average);
- if (discount >= average){
- System.out.printf("Yes, he will earn the world-cup replica ball!\n");
- System.out.printf("His sum is %.2f lv.",discount);
- } else {
- System.out.printf("No, he will not earn the world-cup replica ball.\n");
- System.out.printf("He needs %.2f lv. more.",moreMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment