Answer:
public static void PopcornTime(double bagOunces){
if(bagOunces<2){
System.out.println("Too small");
}
else if(bagOunces>10){
System.out.println("Too large");
}
else{
System.out.println((6*bagOunces)+" seconds");
}
}
Step-by-step explanation:
A Complete Java code with a call to the method PopcornTime() is given below
public class TestClock {
public static void main(String[] args) {
//Calling the method
PopcornTime(2);
}
public static void PopcornTime(double bagOunces){
if(bagOunces<2){
System.out.println("Too small");
}
else if(bagOunces>10){
System.out.println("Too large");
}
else{
System.out.println((6*bagOunces)+" seconds");
}
}
}
The key logic in this code is the use of if/else if/else statements to check the different possible values of of bagOunces.