so I have to write a code for this question:
Write a method printShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." numCycles times, where N is the cycle number, followed by "Done.". End with a newline. Example output for numCycles = 2:
1: Lather and rinse.
2: Lather and rinse.
Hint: Declare and use a loop variable.
but what I've gotten so far is giving me errors and im not sure what im doing wrong. Can someone help me fix my code?
I would makr you down for writing your loop like that. Remember the default format for a for loop is there for a good reason: it works.The + will work as expected because all +s are to the left of the String literal. You can move the ++ into the loop like this:-