Computers and Technology, 05.03.2020 20:55 hectorgonzalejr333
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;
}
}
Answers: 3
Computers and Technology, 21.06.2019 16:00
Page orientation can be either landscape or
Answers: 1
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
Computers and Technology, 23.06.2019 13:00
Donnie does not have powerpoint. which method would be best for elana to save and share her presentation as is? a pdf a doc an rtf a ppt
Answers: 3
Computers and Technology, 23.06.2019 23:30
Perform an online search about the booting process of a computer and list all the steps
Answers: 2
Write a method printShampooInstructions(), with int parameter numCycles, and void return type. If nu...
Mathematics, 15.01.2021 01:00
History, 15.01.2021 01:00
Mathematics, 15.01.2021 01:00
Mathematics, 15.01.2021 01:00
History, 15.01.2021 01:00
History, 15.01.2021 01:00
Mathematics, 15.01.2021 01:00
Biology, 15.01.2021 01:00
Mathematics, 15.01.2021 01:00
Mathematics, 15.01.2021 01:00