Advertisement
Dilyana86

Untitled

May 11th, 2017
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class zadacha2 {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. double price = Double.parseDouble(scan.nextLine());
  7. double puzzle = Double.parseDouble(scan.nextLine());
  8. double doll = Double.parseDouble(scan.nextLine());
  9. double bear = Double.parseDouble(scan.nextLine());
  10. double minion = Double.parseDouble(scan.nextLine());
  11. double truck = Double.parseDouble(scan.nextLine());
  12.  
  13. double sum = puzzle * 2.6 + doll * 3 + bear * 4.1 + minion * 8.2 + truck * 2;
  14. double count = puzzle + doll + bear + minion + truck;
  15. if(count >= 50){
  16. sum = sum * 0.75;
  17. }
  18. sum = sum * 0.9;
  19. if(sum >= price){
  20. System.out.printf("Yes! %.2f lv left.",sum - price);
  21. }else{
  22. System.out.printf("Not enough money! %.2f lv needed.",price - sum);
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement