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
Greeley [361]
3 years ago
14

Write a method printShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, prin

t "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. import java.util.Scanner; public class ShampooMethod { /* Your solution goes here */ public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int userCycles; userCycles = scnr.nextInt(); printShampooInstructions(userCycles); } }
Computers and Technology
1 answer:
iogann1982 [59]3 years ago
4 0

Answer:

import java.util.Scanner;

public class nu3 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter number of cycles");

       int numCycles = in.nextInt();

       //Call the method

       printShampooInstructions(numCycles);

   }

   public static void printShampooInstructions(int numCycles){

                if (numCycles<1){

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

          }

          if (numCycles>4){

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

          }

          else {

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

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

                  numCycles--;

              }

              System.out.println("     Done");

          }

   }

}

Explanation:

This is solved using Java programming language

The method printShampooInstructions() is in bold in the answer section

I have also provided a complete program that request user to enter value for number of cycles, calls the method and passes that value to it

The logic here is using if .... else statements to handle the different possible values of Number of cycles.

In the Else Section a loop is used to decrementally print the number of cycles

You might be interested in
Identifying Characters
alina1380 [7]
The answer is d I just took the test
5 0
3 years ago
Read 2 more answers
A stateful inspection firewall ________. select one:
mart [117]

;) https://quizlet.com/7016715/cyber-security-flash-cards/ go check the link

6 0
3 years ago
Write a short program that allows the user to input a positive integer and then
pogonyaev

Answer:

// code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int n;

   cout<<"Enter a positive number:";

   // read number

   cin>>n;

   // check number is positive or not

   while(n<0)

   {

   // if number is negative

       cout<<"Wrong input!!"<<endl;

       // ask again to enter again

       cout<<"Enter again:";

       // read number again

       cin>>n;

   }

   // generate random number between 1 to n

   int ran=rand()%n +1;

   // print random number

   cout<<"Random number between 1 to "<<n<<" is: "<<ran<<endl;

return 0;

}

Explanation:

Read a number from user.Then if input number is negative then ask user to enter a positive number again.After this generate a random number between 1 to n.Print that random number.

Output:

Enter a positive number:-12

Wrong input!!

Enter again:9

Random number between 1 to 9 is: 2

5 0
3 years ago
Which feature of spreadsheet software will make it easier for you to find the average number of calls made per hour for each emp
max2010maxim [7]

Answer:

It's formula and functions

Explanation:

6 0
4 years ago
Google+ hangouts is connected to what other social media site?
Lynna [10]

Google Plus is the social media site that is connected with Hangouts.

 

To add, Google Plus<span> <span>is an interest-based </span></span>social network<span> <span>that is owned and operated by </span></span>Google. G<span>oogle's fourth foray into social networking, experienced strong growth in its initial years, although usage statistics have varied, depending on how the service is defined.<span> </span></span>

3 0
3 years ago
Other questions:
  • You have taken a new job as a network administrator. Although you have been an IT professional within your organization for a nu
    11·1 answer
  • Which headphone is better for music
    7·1 answer
  • Ayuda no encuentro el concepto de estas tres preguntas: ¿para qué sirve la administración en la ofimatica o informática? ¿Que so
    13·1 answer
  • 1. Assume that the vector monthSales of integers has already been declared and that its elements contain sales data for the 12 m
    11·1 answer
  • A bakery sells three types of muffins whose prices are as follows: 1- blueberry muffin, $2.98 2- chocolate chip muffin, $4.50 an
    6·1 answer
  • The ____ is the point in the past to which the recovered applications and data at the alternate infrastructure will be restored.
    15·1 answer
  • Add an array, which will store the most recent 5 recent transactions. For the array, add an insert function which will store the
    10·1 answer
  • Which activity might require you to provide your social security number
    8·2 answers
  • Name at least TWO kinds of gaming experiences that are possible with these new control devices but were not possible on original
    7·1 answer
  • Section A: A(n) is a collection of information, generally stored as computer files. The information it contains can be stored, u
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!