Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Import {
  3.  
  4. /**
  5. * @param args the command line arguments
  6. */
  7. public static void main(String[] args) {
  8.  
  9. Scanner scan = new Scanner(System.in);
  10.  
  11. double gosti = Integer.parseInt(scan.nextLine());
  12. double cena = Integer.parseInt(scan.nextLine());
  13. double budget = Integer.parseInt(scan.nextLine());
  14. double torta = budget-(budget*0.90);
  15. double suma = 0;
  16. if (gosti > 20){
  17. cena=cena-(cena*0.25);
  18. suma = gosti*cena+torta;
  19. if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
  20. else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}}
  21.  
  22. else if (gosti > 15){
  23. cena=cena-(cena*0.20);
  24. suma = gosti*cena+torta;
  25. if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
  26. else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}
  27. }
  28. else if (gosti > 10){
  29. cena=cena-(cena*0.15);
  30. System.out.println(cena);
  31. suma = gosti*cena+torta;
  32. if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
  33. else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}
  34. }
  35. else {suma = gosti*cena+torta;
  36. if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
  37. else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}}
  38. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement