Sherwin Slaughter wrote:I'm really having trouble with the white spaces concept.
Henry Wong wrote:
Sherwin Slaughter wrote:I'm really having trouble with the white spaces concept.
What "white spaces concept" are you referring to?
Henry
Sherwin Slaughter wrote:I have to ensure white spaces(instead of a comma to separate integers) appear after the user inputs an integer within the array.
Stephan van Hulst wrote:You can learn Java at any time. It's actually probably easier to learn it now, than it is starting with 1.1 and then moving through the versions.
The main problem here is that the names you're using in your method don't really match what you're trying to do: The method is called getDate(), but you're not returning a date. You're not even returning anything. The parameter is called set, but it's not a set, and if it were, it's not clear what it is a set of.
You're retrieving ints from the keyboard, but it's not clear what the ints are supposed to represent.
You had best describe what kind of input you expect the program to deal with, and what the expected result should be. Then come up with a descriptive method name that explains succinctly what it does, and give the method parameter a name that clearly shows what it contains.
Stephan van Hulst wrote:
Sherwin Slaughter wrote:I have to ensure white spaces(instead of a comma to separate integers) appear after the user inputs an integer within the array.
It's not clear what it is you're getting the ints from in the first place. Is kbd a Scanner? If so, it already deals with white space. If you want to add spaces to your array, then it doesn't make sense for it to be an int[], because you can't store spaces in an int[] (and I'm not sure why you'd want to in the first place).
If the result of the method has to represent a date, you might want to use the java.time.LocalDate class, of which you can create an instance using LocalDate.of(int year, int month, int dayOfMonth).
Sherwin Slaughter wrote:
I have to ensure white spaces(instead of a comma to separate integers) appear after the user inputs an integer within the array.
Sherwin Slaughter wrote:
My apologizes. I left a lot of information out. Yes, its utilizing scanner. I typed date instead of data by mistake. I'll have to reword this a bit in order for it to make sense. Sorry about that.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:What happens if you enter a duplicate number? Right now you don't set the new number into the array, but you do increment the index. Is that really what you want?
You are prompting for "at least 20" numbers. Don't you mean "less than 20"?
What happens when you enter a non-integer?
Knute Snortum wrote:
Currently you're sending set[usedSize] into the search() method. Why? Don't you want to test temp?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:
This is what the comments say you should send to the search() method. Notice the third parameter. Are you sending in the correct variable?
Don't get me started about those stupid light bulbs. |