Advertisement
Guest User

Untitled

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