Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.println("How many floors: ");
- int parkingFloor = Integer.parseInt(scanner.nextLine());
- System.out.println("How many spots: ");
- int parkingSpots = Integer.parseInt(scanner.nextLine());
- String[][] cars = new String[parkingFloor][parkingSpots];
- for (int i = 0; i < cars.length; i++) {
- System.out.println();
- for (int j = 0; j < cars[i].length; j++) {
- System.out.println("Car arrived, model: ");
- cars[i][j] = scanner.nextLine();
- }
- if (cars.length - i == 1) {
- break;
- }
- System.out.println("Премина на следващ етаж");
- }
- System.out.println(Arrays.deepToString(cars));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement