Answer:
import java.util.Scanner;
public class PopcornTimer{
public static void printPopcornTime(int 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");
}
public static void main(String[] args) {
printPopcornTime(7);
}
}
Explanation:
Inside the printPopcornTime method, check the bagOunces using if-else structure.
If bagOunces is smaller than print "Too small", if bagOunces is greater than 10 print "Too large", else multiply bagOunces with 6 and print the result followed by "seconds".
Since given parameter, 7, in the example is neither smaller than 2 nor greater than 10, 7 will be multiplied by 6 which is equal to 42, and "42 seconds" will be printed