Campbell Ritchie wrote:… and you can use the getUserInput and validateName methods from inside the setName method.
Christopher Laurenzano wrote:Can you explain to me what import statements or other statements i need to put in my race class (or the entryField class, or both) so the race class can access the elements in the entryField array list?
Yes, you'll need to verify in some way that the string is an integer. The two common ways to do this are:Christopher Laurenzano wrote:
So my question(s) are these:
First: The input of information works fine for now, except when I get to the scratch () method. If I enter anything other than a number or "done" or just enter, I get a number format exception, and I can't figure out why. Even if I put in a condition in the method to check if the input IS NOT either "done" or enter, I still get the exception.
I know it has something to do with the parseInt method, but I don't know of any other means of input that will take either a number or a string. Is there any other means of input that doesn't require the parsing of a string to a number?
As well, what I want to do eventually is create a race program that will use the entryList objects and run the horse race, but I don't know how to write the race method(s) or class that can do this. I've tried to do it but all I get are various types of errors.
Any other helpful tips are welcome and appreciated.
Christopher Laurenzano wrote:
It's not the method, from what I can see. It's the fact that it won't even compile. The methods are public in the Entryfield class, and the entryList Array List is part of the class. But I can't figure out how to get the Race class to use the entryList Array List that's already been created.
Christopher Laurenzano wrote:
But I can't figure out how to get the Race class to use the entryList Array List that's already been created.
Your buns are mine! But you can have this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|