Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PadawanEquipment {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- int studentsCount = Integer.parseInt(scanner.nextLine());
- double priceLight = Double.parseDouble(scanner.nextLine());
- double priceRobe = Double.parseDouble(scanner.nextLine());
- double priceBelt = Double.parseDouble(scanner.nextLine());
- double sumLight = Math.ceil(studentsCount + 0.10 * studentsCount) * priceLight;;
- double sumRobes = studentsCount * priceRobe;
- double sumBelts = (studentsCount - studentsCount / 6) * priceBelt;
- double totalSum = sumLight + sumRobes + sumBelts; //крайната сума за плащане
- if(totalSum <= budget) {
- System.out.printf("The money is enough - it would cost %.2flv.", totalSum);
- } else {
- double needMoney = totalSum - budget;
- System.out.printf("George Lucas will need %.2flv more.", needMoney);
- }
- }
- }
Add Comment
Please, Sign In to add comment