0
Matrices in Java parking can explain me how to do it
The parking lot will present its service, from 07:00 HRS until 22:00 HRS, every day of the week. • The car park matrix will be defined by you N Rows M Columns. • Additionally, motorcycle parking will be implemented in a vector of N positions. The application must support the charging system, and manage the amount of positions available for both cars and motorcycles. The application must allow to register the cars and motorcycles in the positions available.
1 Odpowiedź
0
A matrix is a multidimensional array. Each parking slot can be identified by its row and column position. What you store in the array, is up to the design on your program. Typically you would design a class that represents a parking slot, and it may have some attributes that give information if it's busy or when it was occupied. Then your matrix could be declared as
CarSlot[][] carpark;
or you can just create it as LocalDateTime[][] where an empty value means available spot, and an actual entry marks when a certain car occupied that space.