galinyotsev123

ProgBasicsExam3and4November2018-E02weddingParty

Dec 30th, 2018
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E02weddingParty {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double guests = Double.parseDouble(scanner.nextLine());
  8. double budget = Double.parseDouble(scanner.nextLine());
  9.  
  10. double covert = 20;
  11.  
  12. double TOTAL = guests * covert;
  13.  
  14. double fireworks = 0.40;
  15. double charity = 0.60;
  16.  
  17. if (budget > TOTAL){
  18. double moneyLeft = budget - TOTAL;
  19. System.out.printf("Yes! %.0f lv are for fireworks and %.0f lv are for donation.", moneyLeft * fireworks, moneyLeft * charity);
  20. }
  21.  
  22. else {
  23. double moneyLeft = TOTAL - budget;
  24. System.out.printf("They won't have enough money to pay the covert. They will need %.0f lv more.", moneyLeft);
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment