Утилита сканер
This commit is contained in:
+12
-8
@@ -1,16 +1,20 @@
|
|||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
int roomCount = 4;
|
java.util.Scanner input = new java.util.Scanner(System.in);
|
||||||
int basePrice = 5000;
|
U.pl(" Введите базовую стоимость ремонта одной комнаты ");
|
||||||
int total = 0;
|
|
||||||
|
int basePrice = input.nextInt();
|
||||||
|
U.pl(" Введите количество комнат ");
|
||||||
|
int roomCount = input.nextInt();
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i <= roomCount; i++) {
|
||||||
|
int room = i * basePrice;
|
||||||
|
U.pl("Комната " + i + " стоит " + room);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 1; i <= roomCount; i++) {
|
|
||||||
total += basePrice + (i -1) * 1000;
|
|
||||||
U.pl("Комната " + i + " расчитана.");
|
|
||||||
}
|
|
||||||
U.pl("Итоговая стоимоcть ремонта " + total);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user