Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class GodzillaVsKong_06 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- //статисти, обекло, декор -> разходи = декор + облекло
- //декор = 0.10 * бюджет
- //облекло = бр.статисти * цена за 1 статист
- //проверка дали ще има остъпка
- //разходи -> проверка дали бюджетът стига
- double budget = Double.parseDouble(scanner.nextLine());
- int countStatists = Integer.parseInt(scanner.nextLine());
- double pricePerStatist = Double.parseDouble(scanner.nextLine());
- double decorPrice = 0.10 * budget;
- double clothesPrice = countStatists * pricePerStatist;
- //ако бр.статистите > 150
- if (countStatists > 150) {
- clothesPrice = clothesPrice - 0.10 * clothesPrice; //0.9*clothesPrice
- }
- double expenses = decorPrice + clothesPrice; //общи разходи за филма
- //1. ако е достатъчен бюджетът
- if (budget >= expenses) {
- //достатъчен бюджет
- System.out.println("Action!");
- double leftMoney = budget - expenses;
- System.out.printf("Wingard starts filming with %.2f leva left.", leftMoney);
- } else { //budget < expenses
- //не е достатъчен
- System.out.println("Not enough money!");
- double needMoney = expenses - budget;
- System.out.printf("Wingard needs %.2f leva more.", needMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement