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