Station name printing worked for me but you should change borrowedInput.next().toUpperCase().charAt(0) to borrowedInput.nextInt() when you are reading integer value from user. I would create a small helper method to read the valid integer input so I wouldn't have to implement validity check every time I read integer.
Yes I fixed that problem and are you finding "borrowedInput.next()" in a validation method in MainClass? If so this is not validating an integer. It is to validate the character input from the user when they are choosing a menu option.
You are using borrowedInput.next().toUpperCase().charAt(0) method to read user input even when you are asking an integer value like in validateMaximumCapacity and validateNumberOfStations methods. In these cases you should use borrowedInput.nextInt() instead. Using borrowedInput.next().toUpperCase().charAt(0) method when you are asking a single character, like in main menu, is fine.
Life saver!!! I didn’t realize I was doing that. Omg thank you. I thought I already fixed that a while ago. Well I guess that’s what you get when you copy and try to change one of your components into something else. Lol
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Station name printing worked for me but you should change
borrowedInput.next().toUpperCase().charAt(0)
toborrowedInput.nextInt()
when you are reading integer value from user. I would create a small helper method to read the valid integer input so I wouldn't have to implement validity check every time I read integer.Yes I fixed that problem and are you finding "borrowedInput.next()" in a validation method in MainClass? If so this is not validating an integer. It is to validate the character input from the user when they are choosing a menu option.
You are using
borrowedInput.next().toUpperCase().charAt(0)
method to read user input even when you are asking an integer value like invalidateMaximumCapacity
andvalidateNumberOfStations
methods. In these cases you should useborrowedInput.nextInt()
instead. UsingborrowedInput.next().toUpperCase().charAt(0)
method when you are asking a single character, like in main menu, is fine.Life saver!!! I didn’t realize I was doing that. Omg thank you. I thought I already fixed that a while ago. Well I guess that’s what you get when you copy and try to change one of your components into something else. Lol