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
Consider the code block below. What is the value of amount when this method is called twice, the first time using cookieJar(7) a
RUDIKE [14]

Answer:

C. 22

Explanation:

Given that the argument is being passed by value, there is no memory to consider.  So cookieJar(7) returns 7 and cookieJar(22) returns 22.

If the argument parameter was passed by reference or pointer, then perhaps the value from cookieJar(7) would be considered with cookieJar(22).

Note, this code block really isn't doing anything other than returning the value passed into it.  The "amount" variable is immediately set to 0, and then the value passed in is added to amount (which is 0), and returns.  The following code could replace this function:

public static int cookieJar(int addCookies){

return addCookies;

}

The above code will return an equivalent output to the given code.

Notice, the function is not dependent on any previous call, so the value for each is unique to the call itself, i.e., cookieJar(22) returns 22 and cookieJar(7) returns 7.

So, C. 22 would be correct.

3 0
3 years ago
What term describes one or more characters following the last period in a filename, such as .exe, .txt, or .avi?
elixir [45]

Answer:

Explanation:

.exe: is a file extension, means file that contain executable program which can be run by Microsoft windows.

.txt: is also file extension which contains text (characters).

.avi: means (audio video interleave) is a file extension, which contains audio and video data encoded.

3 0
3 years ago
Compared with non-Internet users, today's online social networkers are likely to experience ________ relationships with their ex
Digiron [165]

Answer: Strengthened, less

Explanation:

With people spending more time on internet their relationships with existing friends have decreased due to lot of contents available on the internet. They might be friends with people miles away but they might not know their next door neighbor. As the content over the internet increases day by the day this trend shall keep on rising.

8 0
3 years ago
Select the correct answer.
bagirrra123 [75]

Answer:

I think the answer is C

Explanation:

Because if you use context clues for the word CINEMATOGRAPHER, cinema is like scene and lights and tographer is the person who adjusts it

4 0
3 years ago
________ systems help supervisors by generating databases that act as the foundation for other information systems. Group of ans
Dahasolnce [82]

Answer:

1. Decision support systems

Explanation:

DSS (Decision Support Systems) are systems that provide supports for decisions, judgments and analysis in an organization. They help in solving problems and in decision-making. With DSS, databases that act as foundation for other information systems can be generated for supervisors helping them to make logical analysis of a particular problem hence solving it.

DSS will actually not give the decision, but will guide the decision maker in making the decision by helping to gather raw facts and useful models which enhance decision making.

6 0
4 years ago
Other questions:
  • What provision of the Government Paperwork Elimination Act was designed to encourage a paperless society?
    6·2 answers
  • Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li
    14·1 answer
  • If you face an investigation where dangerous substances might be around, you may need to obtain which of the following?
    13·2 answers
  • why does my Minecraft screen this "play and "settings" instead of the regular layout with singleplayer, multiplayer, and options
    11·2 answers
  • Find the smallest value of n such that LCM of n is 15 is 45​
    5·1 answer
  • What is the purpose of creating a primary key in a database
    14·1 answer
  • An IT systems engineer creates a new Domain Name System (DNS) zone that contains pointer (PTR) resource records. Which zone type
    15·1 answer
  • Tipos de lenguajes relacionados con c++?
    7·1 answer
  • How can a user remove or delete a Pivot Table?
    8·1 answer
  • Does anyone know how to permanently delete photos on a dell computer? For my cousin.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!