Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budjet = Double.parseDouble(scanner.nextLine());
- double skiPrice = Double.parseDouble(scanner.nextLine());
- double shtekiPrice = Double.parseDouble(scanner.nextLine());
- double shoesPrice = skiPrice - (skiPrice * 0.6);
- double clothesPrice = skiPrice + (skiPrice * 0.4);
- double firstSum = skiPrice + shoesPrice + clothesPrice;
- if (firstSum > 800){
- shtekiPrice = 0;
- }
- double sum = skiPrice + shtekiPrice + shoesPrice + clothesPrice;
- double leftMoney = Math.abs(budjet - sum);
- double needMoney = Math.abs(sum - budjet);
- if (budjet > sum){
- System.out.printf("Angel's sum is %.2f lv. He has %.2f lv. left.", sum, leftMoney);
- } else if (budjet < sum) {
- System.out.printf("Not enough money! You need %.2f leva more!", needMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement