subject

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.
Done.
Hint: Declare and use a loop variable.

import java. util. Scanner;
public class ShampooMethod {

/ Your solution goes here /
public static void printShampooInstructions(int numCycles){

if(numCycles < 1){
System. out. println("Too few.");
}
else if(numCycles > 4){
System. out. println("Too many.");
}
else{
for(int i = 1; i <= numCycles; i++){
System. out. println(i + ": Lather and rinse.");
}
System. out. println("Done.");
}
}
/ Your solution end here /
public static void main (String [] args) {
printShampooInstructions(2);

return;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:30
Gerard is currently working as an entry-level customer support technician, but he would like to someday become a software developer. what is the best first step to understand what he should do? ask his manager for a new job or at least a job recommendation study graphic design in order to obtain the necessary skills use career resources to investigate what skills and education are required work part-time as an entry-level web developer question 13 (true/false worth 6 points) (08.03 lc) career resources are used to explore career options and find career information. true false question 14(multiple choice worth 6 points) (08.01 mc) classify the following skills: writing html code, evaluating color theory, using design principles. hard skills interpersonal skills people skills soft skills question 15 (true/false worth 6 points) (08.03 lc) a mentor is a person who is advised, trained, or counseled by a trusted mentee. true false
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 24.06.2019 00:40
What social factors affect your health
Answers: 3
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
You know the right answer?
Write a method printShampooInstructions(), with int parameter numCycles, and void return type. If nu...
Questions
question
Mathematics, 14.04.2020 21:05
question
Mathematics, 14.04.2020 21:05
question
Mathematics, 14.04.2020 21:05
Questions on the website: 13722363