SHOW:
|
|
- or go back to the newest paste.
| 1 | import java.util.Scanner; | |
| 2 | ||
| 3 | - | public class PadawanEquipment_09 {
|
| 3 | + | public class PadawanEquipment {
|
| 4 | public static void main(String[] args) {
| |
| 5 | Scanner scanner = new Scanner(System.in); | |
| 6 | - | //обща сума = сума за мечове + сума за одежди + сума за колани |
| 6 | + | |
| 7 | - | //1. сума за мечове = бр. мечове(ученици + 10%) * цена за мечовете(вход) |
| 7 | + | |
| 8 | - | //2. сума за одежди = бр. одежди = бр. ученици * цена за одеждите(вход) |
| 8 | + | |
| 9 | - | //3. сума за колани = бр. коланите (ученици - ученици / 6) * цена за коланите(вход) |
| 9 | + | |
| 10 | double priceRobe = Double.parseDouble(scanner.nextLine()); | |
| 11 | double priceBelt = Double.parseDouble(scanner.nextLine()); | |
| 12 | ||
| 13 | double sumLight = Math.ceil(studentsCount + 0.10 * studentsCount) * priceLight;; | |
| 14 | double sumRobes = studentsCount * priceRobe; | |
| 15 | double sumBelts = (studentsCount - studentsCount / 6) * priceBelt; | |
| 16 | - | double sumLight = Math.ceil(studentsCount + 0.10 * studentsCount) * priceLight; //1.1 * studentsCount |
| 16 | + | |
| 17 | double totalSum = sumLight + sumRobes + sumBelts; //крайната сума за плащане | |
| 18 | ||
| 19 | if(totalSum <= budget) {
| |
| 20 | System.out.printf("The money is enough - it would cost %.2flv.", totalSum);
| |
| 21 | } else {
| |
| 22 | double needMoney = totalSum - budget; | |
| 23 | System.out.printf("George Lucas will need %.2flv more.", needMoney);
| |
| 24 | } | |
| 25 | ||
| 26 | - | System.out.printf("Ivan Cho will need %.2flv more.", needMoney);
|
| 26 | + | |
| 27 | } | |
| 28 |