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
mixer [17]
3 years ago
15

Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than

10, print "Too large". Otherwise, compute and print 6 * bag_ounces followed by "seconds". End with a newline. Sample output with input: 7 42 seconds
Computers and Technology
1 answer:
Gnoma [55]3 years ago
3 0

Answer:

public static void print_popcorn_time(int bag_ounces){

       if(bag_ounces<3){

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

       }

       else if(bag_ounces>10){

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

       }

       else{

           bag_ounces*=6;

           System.out.println(bag_ounces+" seconds");

       }

   }

Explanation:

Using Java prograamming Language.

The Method (function) print_popcorn_time is defined to accept a single parameter of type int

Using if...else if ....else statements it prints the expected output given in the question

A complete java program calling the method is given below

public class num6 {

   public static void main(String[] args) {

       int bagOunces = 7;

       print_popcorn_time(bagOunces);

   }

   public static void print_popcorn_time(int bag_ounces){

       if(bag_ounces<3){

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

       }

       else if(bag_ounces>10){

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

       }

       else{

           bag_ounces*=6;

           System.out.println(bag_ounces+" seconds");

       }

   }

}

You might be interested in
Write a function that receives a StaticArray and returns an integer that describes whether the array is sorted. The method must
koban [17]

Answer:

is_sorted(arr: StaticArray) -&gt; int: Write a function that receives a StaticArray and returns an integer that describes whether the array is sorted. The method must return: 1

Explanation:

4 0
2 years ago
Plz answer it’s timed
MAVERICK [17]

Answer: the third one

Explanation:

just trust me, the other ones dont mke sense to what I know about the subject, which is a lot

7 0
3 years ago
How does a computer interact with its environment?
Zielflug [23.3K]

Answer:

Explanation:

A computer system can interact with its environment using hardware that does so such as cameras, robotic arms, thermometers, smart devices etc. These hardware devices gather information from the environment and transfer it to the computer system in a format known as bits through binary electrical impulses.

6 0
3 years ago
Read 2 more answers
Into which of these files would you paste copied information to create an integrated document? A. Mailing list B. Source C. Data
viva [34]

it would be b.mailing list


5 0
3 years ago
Read 2 more answers
After a customer buys a computer or receives service from Top Computers and Service, a service representative contacts each cust
Crank
The answer is A. True
4 0
3 years ago
Other questions:
  • Which of the following statements is the least abstraction of the World Wide Web?
    15·1 answer
  • Which modem settings should be configured on DSL or cable modems?
    14·1 answer
  • Which of the following about Java arrays is true?
    14·1 answer
  • Identify methods to improve programming skills.
    15·1 answer
  • An example of negative self-talk is:
    13·2 answers
  • Tell me the errors please
    14·1 answer
  • (python) Given the formula for conversion from Celsius to Fahrenheit
    10·1 answer
  • What does it mean to influence the government? Use influence in a sentence.
    8·2 answers
  • Arrange these steps of creating a presentation in the correct order. (notice that the given order is incorrect other than the ba
    13·1 answer
  • Intro Programming - Problem(s)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!