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