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