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