Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class WeddingParty {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int numberGuests = Integer.parseInt(scanner.nextLine());
- int budget = Integer.parseInt(scanner.nextLine());
- double totalMoney = numberGuests * 20;
- if (totalMoney <= budget) {
- double moneyLeft = budget - totalMoney;
- double moneyFireworks = moneyLeft * 0.4;
- double moneyDonation = moneyLeft - moneyFireworks;
- System.out.printf("Yes! %.0f lv are for fireworks and %.0f lv are for donation.",moneyFireworks,moneyDonation);
- }
- else {
- System.out.printf("They won't have enough money to pay the covert. They will need %.0f lv more.",totalMoney - budget );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement