Complete method printPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by "seconds". End with a newline. Example output for ounces = 7: 42 seconds
code:
import java.util.Scanner;
public class PopcornTimer {
public static void printPopcornTime(int bagOunces) {
/* Your solution goes here */
}
public static void main (String [] args) {
printPopcornTime(7);
}
}

Respuesta :

Answer:

if(bagOunces < 2){

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

  }

  else if(bagOunces > 10){

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

  }

  else{

      System.out.println(6*bagOunces+" seconds");

  }

Explanation:

Ver imagen DarthVaderBarbie

The missing code segment is an illustration of conditional statements.

Conditional statements are used to execute statements depending on the truth value of the condition.

The missing code segment, where comments are used to explain each line is as follows:

//If bagOunces is less than 2

if(bagOunces < 2){

//This prints "Too small"

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

 }

//If bagOunces is greater than 10

 else if(bagOunces > 10){

//This prints "Too large"

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

 }

//Otherwise

 else{

//This calculates and prints the popcorn time

     System.out.println(6*bagOunces+" seconds");

}

Read more about similar programs at:

https://brainly.com/question/7253053

Q&A Education