1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kow [346]
4 years ago
8

Write a method printshampoolnstructions0, 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 with input 2:
1: Lather and rinse.
2: Lather and rinse. Done. Hint: Declare and use a loop variable

İmport java.util.Scanner;
public class ShampooMethod ( 5 Your solution goes here
public static void main (String [1 args) (
Scanner senr new Scanner(System.in);
int userCycles; 10
userCycles scnr.nextInt): printShaspooInstructions(userCycles);
Computers and Technology
1 answer:
fredd [130]4 years ago
3 0

Answer:

// Scanner import to allow user enter input

import java.util.Scanner;

// Class definition

public class ShampooMethod {

   // The beginning of program execution which is the main method

   public static void main(String args[]) {

       //Scanner object to receive user input via the keyboard

       Scanner scan = new Scanner(System.in);

       //The received input is assigned to userCycles variable

       int userCycles = scan.nextInt();

       //printShampooInstructions method is called with userCycles as argument

       printShampooInstructions(userCycles);

   }

   

   // The printShampooInstructions is defined

   public static void printShampooInstructions(int numCycles){

       // Check if numCycles is less than 1 and output "too few"

       if(numCycles < 1){

           System.out.println("Too few...");

       } else if (numCycles > 4){

           System.out.println("Too many...");

       } else{

          // for-loop which repeat for the range of numCycles and display the instruction

           for(int i = 1; i <= numCycles; i++){

               if(i == numCycles){

                   System.out.println(i + ":" + " Lather and rinse. Done.");

               } else{

                   System.out.println(i + ":" + " Lather and rinse.");

               }

              }

           }

       }

   }

Explanation:

The code has been commented to be explanatory. First the Scanner class is imported, then the class is defined. Then, the main method is also declared. Inside the main method, the user input is accepted and assigned to userCycles. The userCycles is passed as argument to the printShampooInstructions.

The printShampooInstructions is created with a parameter of numCycle and void return type. If the numberCycle is less than 1; "Too few..." is outputted. If numCycle is greater than 4; "Too many" is displayed. Else the shampoo instuction "Lather and rinse" is repeated for the numCycle. During the last repetition, "Done" is attached to the shampoo instruction.

You might be interested in
"The ability to assign system policies, deploy software, and assign permissions and rights to users of network resources in a ce
Hatshy [7]

Answer:

Active Directory

Explanation:

The 2012 R2 Windows Server  is the 6th version of  Windows Server server operating system which is made by Microsoft. It is a part of the Windows NT family of the operating systems.

Active Directory helps to store the default user profiles as well as the user login scripts.

It helps to assign the system policies, assign  permission to the users overt he network resources and also to deploy software in a centralized manner.

3 0
3 years ago
Idea citizen activation
Tatiana [17]
<h2>Answer:</h2><h2>Idea citizen activation badge is a part of the idea silver award and is in the citizen category,helping you learn digital awareness,safety and ethics.</h2>

7 0
4 years ago
Read 2 more answers
What usually happens at a police check? Do they just look up your name in their system?
sdas [7]

it depends on the kind of police check. like if its a road block type of check, they make sure everything is right. if you get pulled over you get your name ran in the system to check if you have warrents or warning and depends on what you get pulled over for, you could get a ticket or detained.

5 0
4 years ago
When you choose a(n) ___________ installation, you only install selected features, rather than all of the features associated wi
lisabon 2012 [21]

Answer:

When you choose a(n) <em><u>custom</u></em> installation, you only install selected features, rather than all of the features associated with a software program.

Explanation:

There are two types of installation while installing a software

1. Default

2. Custom

In default installation, all the features of a software program are installed while when the custom installation mode is selected, the user can select which features of the software he wants to install instead of all features.

So,

When you choose a(n) <em><u>custom</u></em> installation, you only install selected features, rather than all of the features associated with a software program ..

8 0
3 years ago
You are choosing between two different window washing companies. The first charges $5 per window. The second charges a base fee
tatiyna

Answer:

20

Explanation:

8 0
2 years ago
Other questions:
  • kara, darrell and jose all enjoy watching comedies online. kara and jose also enjoy watching dramas. using content-based filteri
    12·1 answer
  • What temporarily holds programs and date while the computer is on and allows the computer to access that information randomly?
    12·1 answer
  • Which command runs poweroff.target to shutdown the system?
    11·1 answer
  • In a relational database, the three basic operations used to develop useful sets of data are:
    10·1 answer
  • Janice is making her resume in which section should she include information about her previous employers , positions held , and
    15·1 answer
  • Computer simulations can: A. accurately predict the weather a month in advance.
    11·1 answer
  • How are satellite radio, Internet radio, and podcasting different?
    11·1 answer
  • Create a script to input 2 numbers from the user. The script will then ask the user to perform a numerical calculation of additi
    7·1 answer
  • <img src="https://tex.z-dn.net/?f=%5Cmathcal%7B%5Cfcolorbox%7Bblue%7D%7Byellow%7D%7B%5Cred%7BQUESTIONS%3A%7D%7D%7D" id="TexFormu
    9·2 answers
  • Page 1. I who invented computer?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!