DEV Community

Andrew Jackson
Andrew Jackson

Posted on

Train Simulation Problems - Update

Thanks for yesterday.

Hey everyone,

So, I have gotten pretty far with the Train Simulation from the help I've gotten yesterday. Thank you to all that helped! I really appreciate it. Most of the problems I had were with things I thought I had fixed already but didn't. I think I just needed some extra eyes on this problem. Usually, everyone is by themselves trying their hardest to figure out a problem, but, sometimes all you need to do is put your ego and pride aside and ask for help.


To update you on this project, I have pretty much solved all those pesky problems I had, but then, others have popped up...

Peskipiksi pesternomi!
It had no effect...

The issue where the number of stations that were entered, were not how many stations you went to. So let's say I entered 3 as the number of stations. I would instead get 100 stations because the getCurrentStation method was not actually returning the current station.

The other major issue I had involed the station name. It turns out I was trying to get a char instead of an integer to return the current station index. SMH... I felt so dumb but thats why you ask for help. I thought I already corrected it when I copied and changing it from another method.

Current problems.

With these problems solved I am now having a problem with getting the current station... Yes, this is unexpected considering I just fixed it to where it wouldn't print out 100 stations anymore. Now, it is only giving me one station when it is supposed to be adding 1 after each station and subtracting 1 if the stopCounter is not less than the number of stations.

The other problem I am having is with the display of the Usage Report. It is supposed to be shown at the end of the program after you have already run a simulation. If the current trains create counter is less than 0 then it is supposed to display the usage report with the user name, the create counter, and the run counter. So far I have not been able to figure out why this happening.

I am asking once again.

Well, like the great Bernard Sanders it's that time again when I ask you for your help. I am learning a lot from these post and do think I will continue to post about these school projects. If you can lend your eyes toward this project and tell me if you see any discrepancies in the code that would cause these problems, I would greatly appreciate it.

Thanks for reading.

Top comments (0)