Advertisement
ver4oni

WeddingParty

Dec 15th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 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 numberGuests = Integer.parseInt(scanner.nextLine());
  8.         int budget = Integer.parseInt(scanner.nextLine());
  9.  
  10.         double totalMoney = numberGuests * 20;
  11.  
  12.         if (totalMoney <= budget) {
  13.         double moneyLeft = budget - totalMoney;
  14.         double moneyFireworks = moneyLeft * 0.4;
  15.         double moneyDonation = moneyLeft - moneyFireworks;
  16.             System.out.printf("Yes! %.0f lv are for fireworks and %.0f lv are for donation.",moneyFireworks,moneyDonation);
  17.  
  18.         }
  19.         else {
  20.             System.out.printf("They won't have enough money to pay the covert. They will need %.0f lv more.",totalMoney - budget );
  21.  
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement