Утилитарный класс U для сокращения вывода

This commit is contained in:
Евгений
2026-06-12 08:16:01 +03:00
parent ab20db85ba
commit 051b456e98
2 changed files with 25 additions and 8 deletions
+9 -7
View File
@@ -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 + " успешно поднято на этаж. ");
int roomCount = 4;
int basePrice = 5000;
int total = 0;
for (int i = 1; i <= roomCount; i++) {
total += basePrice + (i -1) * 1000;
U.pl("Комната " + i + " расчитана.");
}
System.out.println(" Всего затрачено энергии " + totalEnergy + " едениц.");
System.out.println(" Все окна доставлены, бригада свободна");
U.pl("Итоговая стоимоcть ремонта " + total);
}
}
+15
View File
@@ -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);
}
}