Question: Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for sample program: 3.5 import java.util. Scanner; public class Hour

Answer in JAVA

1.

Complete the method definition to output the hours given minutes. Output for sample program:

3.5

import java.util. Scanner;
public class Hour To Min Conv {
public static void output Minutes As Hours(double orig Minutes) {

/* Your solution goes here */

}

public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
double minutes;

minutes = scnr.nextDouble();

output Minutes As Hours(minutes); // Will be run with 210.0, 3600.0, and 0.0.
System.out.println("");
}
}

2.

Define a method print Feet Inch Short, with int parameters num Feet and numInches, that prints using ' and " shorthand. End with a newline. Ex: print Feet Inch Short(5, 8) prints:

5' 8"

Hint: Use " to print a double quote.

import java.util. Scanner;

public class Height Printer {

/* Your solution goes here */

public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int user Feet;
int user Inches;

user Feet = scnr.nextInt();
user Inches = scnr.nextInt();

print Feet Inch Short(user Feet, user Inches); // Will be run with (5, 8), then (4, 11)
}
}

3.

Write a method print Shampoo Instructions(), with int parameter num Cycles, and void return type. If num Cycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." num Cycles 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 Shampoo Method {

/* Your solution goes here */

public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int userCycles;

user Cycles = scnr. nextInt();
print Shampoo Instructions(user Cycles);
}
}


Step by Step Solution

3.45 Rating (168 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class HourToMinConv public static void outputMinutesAsHoursdo... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!