Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         double budjet = Double.parseDouble(scanner.nextLine());
  11.         double skiPrice = Double.parseDouble(scanner.nextLine());
  12.         double shtekiPrice = Double.parseDouble(scanner.nextLine());
  13.  
  14.         double shoesPrice = skiPrice - (skiPrice * 0.6);
  15.         double clothesPrice = skiPrice + (skiPrice * 0.4);
  16.  
  17.         double firstSum = skiPrice + shoesPrice + clothesPrice;
  18.  
  19.         if (firstSum > 800){
  20.             shtekiPrice = 0;
  21.         }
  22.        
  23.  
  24.         double sum = skiPrice + shtekiPrice + shoesPrice + clothesPrice;
  25.         double leftMoney = Math.abs(budjet - sum);
  26.         double needMoney = Math.abs(sum - budjet);
  27.  
  28.         if (budjet > sum){
  29.             System.out.printf("Angel's sum is %.2f lv. He has %.2f lv. left.", sum, leftMoney);
  30.         } else if (budjet < sum) {
  31.             System.out.printf("Not enough money! You need %.2f leva more!", needMoney);
  32.         }
  33.  
  34.     }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement