Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int guests = Integer.parseInt(scanner.nextLine());
  8. int budget = Integer.parseInt(scanner.nextLine());
  9.  
  10. int expenses = guests * 20;
  11.  
  12. if (budget >= expenses){
  13. int moneyLeft = budget - expenses;
  14. double fireworks = moneyLeft * (40 / 100.0);
  15. double charity = moneyLeft - fireworks;
  16.  
  17. System.out.printf("Yes! %.0f lv are for fireworks and %.0f lv are for donation.", fireworks, charity);
  18. }else{
  19. int moneyNeeded = expenses - budget;
  20. System.out.printf("They won't have enough money to pay the covert. They will need %d lv more.", moneyNeeded);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement