Please give me help

Please give me help


To write a program in Java: 20 parking places. When a car needs parking, the system automatically gives an available parking space,and update the number of cars available.


Hello, I believe you haven’t received a solution yet because we can’t identify the question (or the point at which you require help) from the statement given.
You should be clearer.:wink:


sounds like a job for… Arrays!

set up some basic array stuff and work with that?

var maxLen = 20;
var spaces =  Array(maxLen).fill(0); // init array to 20 items.
var park = spaces.splice(1, 1); // remove one available space from array


I need code written in Java.thank you very much.


When a car in the parking lot needs parking, the system automatically gives it a parking space and updates the available parking space
I need code written in Java.thank you very much.



thank you very much! This has helped me a lot.:smile:


Java is not one of the languages we teach here. You are welcome to ask questions about it, just realize that it is not our specialty. There are some people that do Java here, but it is not he focus. But it is bad form to ask us to do the program for you - we are not a bunch of people taking on other people’s coding work. We are people helping each other learn.

Better forum etiquette would be for you to post what you’ve done so far and ask us why it isn’t working. We are not here to help you do your homework or build something for you for free.

For anyone with any coding experience, this is a pretty trivial problem. I would suggest starting with a beginner Java book. And a simple google search will help you find a Java forum where you will get better responses.


Thanks for the tip. My idea wasn’t to have someone else do it for my code. I knew I had to practice it myself.But I need a teacher’s guidance as I study.You’re good Java users.You can be my teachers.


You still haven’t provided any evidence that you’ve even attempted the problem. The point of homework is that you try to complete it yourself first, and ask Mom and Dad for help only when you get stuck.


The question I’m asking is not about homework or other assignments. It’s my idea. It’s a simple function I want to accomplish on my own. I 've been looking for a lot of information.
But it didn’t work. thank you very much.


So what have you tried so far? Xiija already gave a hint — did you try Googling arrays in java?


I’m a beginner. Xiija gave it to me. I 've read it many times.Some code can give me a lot of insight. My original idea was to create a two-dimensional array.Then a parking space is provided in this array.And update the available parking space in the array.


How would you implement this in code?

How would you implement this in code?