Lines 102 to 124 is my inputSystemTask() method. It asks users to input a month, day, hour, minute, and a message. It then passes each variable to another class, UserInput(), to check for correct input.
Lines 94 to 100 is my toString() method that prints a message using the month, day, hour, minute, and message variables.
On lines 128 to 130 of my main method I am attempting to print the new user input variables using my toString() method. It will print my default values for my variables, but not my new user input variables.
Where am I going wrong?
As far as I can see: your method where input takes place doesn't actually assign any values to month, day, and so on. It passes those things into your mysterious UserInput class, for why I don't know. Maybe those assignment statements are the wrong way around?
Scott M Summers wrote:Right, I am sending values to my UserInput class, to check if it is within the correct parameters. I'm using to set the value from the variable in UserInput to the value for my variable in SystemTask.
But you already know that the value of the month variable is correct. It's "Jan", because you already assigned that value to it in the constructor. So what's the point of sending it to the UserInput class? Shouldn't you be checking the value which the user typed in instead?
Especially since you don't seem to do anything after that, based on whether it's acceptable or not. Especially, you don't assign any new value to the month variable, and that results in the problem you already complained about.
"Jan" is the default value for month.
I don't want to send my default value to my UserInput class, nor am I. I send the user input from inputSystemTask() to the UserInput class.
UserInput will check to see if the user input is within the parameters and returns a variable. I need the returned variable from UserInput to be assigned as my new month, new day, new hour, and new message. This way I can print the new variables that the user input using my toString() method.