Утилитарный класс U для сокращения вывода
This commit is contained in:
+9
-7
@@ -1,14 +1,16 @@
|
|||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int totalEnergy = 0;
|
|
||||||
int isolierglas = 5;
|
|
||||||
|
|
||||||
for (int i = 1; i <= isolierglas; i++) {
|
int roomCount = 4;
|
||||||
totalEnergy += i;
|
int basePrice = 5000;
|
||||||
System.out.println(" Окно номер " + i + " успешно поднято на этаж. ");
|
int total = 0;
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i <= roomCount; i++) {
|
||||||
|
total += basePrice + (i -1) * 1000;
|
||||||
|
U.pl("Комната " + i + " расчитана.");
|
||||||
}
|
}
|
||||||
System.out.println(" Всего затрачено энергии " + totalEnergy + " едениц.");
|
U.pl("Итоговая стоимоcть ремонта " + total);
|
||||||
System.out.println(" Все окна доставлены, бригада свободна");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
public class U {
|
||||||
|
|
||||||
|
public static void pl (String text) {
|
||||||
|
System.out.println(text);
|
||||||
|
}
|
||||||
|
public static void pl (int number) {
|
||||||
|
System.out.println(number);
|
||||||
|
}
|
||||||
|
public static void pl (double number) {
|
||||||
|
System.out.println(number);
|
||||||
|
}
|
||||||
|
public static void pl (float number) {
|
||||||
|
System.out.println(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user