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
SVETLANKA909090 [29]
3 years ago
14

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.
Computers and Technology
2 answers:
yawa3891 [41]3 years ago
8 0

Answer:

void print_popcorn_time(int bag_ounces){

   if(bag_ounces < 3){

       cout<<"Too small"<<endl;

   }else if(bag_ounces > 10){

       cout<<"Too large"<<endl;

   }else{

       cout<<(6 * bag_ounces)<<"seconds"<<endl;

   }

}

Explanation:

The function is the block of the statement which performs the special task.

For checking the condition in the program, the if-else statement is used.

It can check the condition one or two but if we want to check the more than two different conditions then the continuous if-else statement is used.

syntax of continuous if else:

if(condition){

statement;

}else if(condition)

statement;

}else{

statement;

}

In the question, there are three conditions;

1. bag_ounces is less than 3

2. bag_ounces greater than 10

3. else part.

we put the condition in the above if-else statement and print the corresponding message.

erastova [34]3 years ago
5 0

Answer:

def print_popcorn_time(bag_ounces):

   if bag_ounces < 3:

       print("Too small")

   elif bag_ounces > 10:

        print("Too large")

   else:

        bag_ounces = bag_ounces * 6

        print(bag_ounces, "seconds")

Explanation:

def print_popcorn_time(bag_ounces): #fed function

   if bag_ounces < 3:  #1st if statement

       print("Too small") #print function

   elif bag_ounces > 10: #else if

        print("Too large") #print than print

   else:  #else:

        bag_ounces = bag_ounces * 6 #do work

        print(bag_ounces, "seconds") #print

You might be interested in
Linda wants to change the color of the SmartArt that she has used in her spreadsheet. To do so, she clicks on the shape in the S
Julli [10]

Answer: Theme colors

Explanation:

Based on the directions, Linda most probably went to the "Theme colors" option as shown in the attachment below. Theme colors enables one to change the color of their smart shape.

It is located in the "Format tab" which is under "Drawing tools" in the more recent Excel versions. Under the format tab it is located in the Shape Styles group as shown below.

8 0
2 years ago
Which of these is NOT a sign that someone might be drunk
earnstyle [38]

Answer:

what are the signs someone would or would not be drunk

7 0
3 years ago
Read 2 more answers
Which of these categories of computer software can add thousands of dollars to the cost of a computer system?
Radda [10]
Specialized software. hope this helps
6 0
3 years ago
If the moon disappeared, what effect would this have on the Earth’s tides?
avanturin [10]
<span>There would no longer be any tides.< this seems like the most probable answer because there will be no gravitational pull from the moon that causes tides 
</span>
8 0
3 years ago
Write a C++ nested for loop code to print out the following onthe screen1 2 3 4 5 67 8 91 2 3 4 5 67 81 2 3 4 5 671 2 3 4 561 2
Mekhanik [1.2K]

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   

  //nested for loop

   for(int i=9;i>=1;i--){

       for(int j=1;j<=i;j++){

          cout<<j<<" ";  //display

       }

   }

   return 0;

}

Explanation:

Include the library iostream for using the input/output instruction in the c++ programming.

Create the main function and takes nested for loop. Nested for loop means, for loop inside the another for loop.

For every value of outside for loop, inside for loop execute.

we make outer for loop in decreasing format, means it start from 9 and goes to 1 and inside for loop make in increasing format, means loop start from 1 and it goes to that value which is provided by the outer loop.

and print the output for every cycle.

Lets dry run the code:

the outer loop starts from 9 and it checks the condition 9>=1, condition true. then the program moves to the inner loop which starts from 1 and goes to the 9.

first, it also checks the condition 1 <= 9, condition true and prints the number from 1 to 9.

then,  i is reduced by 1. it means i become 8.

then, the above process continues from 1 to 8 and so on...

the loop process will terminate if the outer loop terminate.

Finally, we get the output.

6 0
2 years ago
Other questions:
  • Another html/css assignment, drop css code below, thank you
    15·1 answer
  • Seth would like to make sure as many interested customers as possible are seeing his business’s website displayed in their searc
    9·1 answer
  • What was the first video game ever invented
    11·2 answers
  • For a typical middle-income family, what is the estimated cost of raising a child to the age of 18?
    11·1 answer
  • I don't know if this is supposed to go here or art but i need help with photoshop, basically you can create whatever you want bu
    7·1 answer
  • Please help thank u!!!!!
    13·2 answers
  • A student will not be allowed to sit in exam if his/her attendance is less than 75% .
    8·1 answer
  • Does anyone know any good new online multiplayer console games that are either out or coming out soon.
    7·1 answer
  • Jackie is planning a surprise birthday party for her best friend and is researching a location to have the party. Jackie found a
    6·1 answer
  • Two technicians are discussing Newton's first law of motion. Technician A says that a lightweight vehicle requires as
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!