Kyle Mills wrote:your If is not correct, use brackets where possible
not correct:
correct:
When I changed this it starts to go into the second section, but it still doesn't recognize "stop", it just acts as though stop is a name, and it asks me for the employee wage forever.
Jorge Gutierrez wrote:When I changed this it starts to go into the second section, but it still doesn't recognize "stop", it just acts as though stop is a name, and it asks me for the employee wage forever.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Jorge Gutierrez wrote:I made all the edits suggested, ran the code, and this is the exact output from the IDE:
It actually wont allow me to enter the employee name again, and when I enter a wage, it just repeats "Enter Hourly Wage" over and over.
I want to apologize to everyone for my ignorance...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Jorge Gutierrez wrote:I made all the edits suggested, ran the code, and this is the exact output from the IDE:
That's fine, but it's not what I asked for.
It actually wont allow me to enter the employee name again, and when I enter a wage, it just repeats "Enter Hourly Wage" over and over.
So, look at the loop you've written to enter the wage and tell me (or us) exactly what it does. In detail.
What does 'System.out.println("Enter Hourly Wage");' do?
What does 'number1 = input.nextInt();' do?
Like that. And keep going until you've described the entire loop.
I want to apologize to everyone for my ignorance...
Not a problem. We've all been there. But if we just hand you the answer you won't learn.
So, once again, look at your "enter wage" loop and do as I suggest.
The simple act of describing to us what it does will probably tell YOU what's wrong.
Winston
Jorge Gutierrez wrote:while(number1 >0);
Winston, once I did this I face-palmed. Of course the loop is going to continue forever; I'm asking it to continue as long as the number entered is greater than zero...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Junilu Lacar wrote:
The other problem you have is that you have everything in main. This makes it difficult for you to isolate problems because everything you have is piled into one method. But I don't know if you've learned about methods and breaking up a big, complex task into many smaller and simpler ones.
Jorge Gutierrez wrote:I also dont understand why it shows "Enter Employee Name" twice.
![]()
Jorge Gutierrez wrote:Since this is what the instructor of my course says its supposed to look like, but as I learned from Winston, reading this code line by line tells me that "Enter Employee Name" will just repeat forever if I dont enter stop.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Jorge Gutierrez wrote:because the assignment states that I have make the program continue to request information until "stop" is entered as the employee name, and the instructors are really picky with specifics when it comes to grading.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Jorge Gutierrez wrote:I just wanted to update everyone on what I did with this. I was unable to figure out how to make it work in the way that the assignment was asking, but I was able to make it work another way. Fortunately, the instructor gave me a perfect score on this.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |