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
What are the factors affecting the life of ballast? Explain.​
Nady [450]

Answer:

When it's too hot or too cold.

Explanation:

When a bulb of the wrong size or voltage is used in the fixture, the ballast often overheats, causing the light to shut off. The bulbs and the fixture must also match in frequency, or the ballast becomes overworked and overheated.

7 0
3 years ago
How do you restore deleted notpad++ file?
Natasha2012 [34]
Check your trash can, if that doesnt work then I would say its lost.
3 0
3 years ago
Press ____ to select the entire worksheet.<br> F1<br> F4<br> ALT+A<br> CTRL+A
andreev551 [17]
<span>The answer is CTRL + A, this selects whole worksheet (A means all). In computing, a Control key is a transformer key which, when pushed in combination with one more key, achieves a singular operation (for example, Ctrl + A; like the Shift key, the Control key infrequently achieves any purpose when pushed by itself.</span>
5 0
3 years ago
QUESTION 6 Which of the following is a class A IPv4 address? a. 118.20.210.254 b. 183.16.17.30 c. 215.16.17.30 d. 255.255.0.0
shepuryov [24]

Answer:

a. 118.20.210.254

Explanation:

Here are the few characteristics of Class A:

First bit of the first octet of class A is 0.

This class has 8 bits for network and 24 bits for hosts.

The default sub-net mask for class A IP address is 255.0.0.0

Lets see if the first bit of first octet of 118.20.210.254 address is 0.

118 in binary (8 bits) can be represented as : 1110110

To complete 8 bits add a 0 to the left.

01110110

First bit of the first octet of class A is 0 So this is class A address.

For option b the first octet is : 183 in the form of bits = 10110111 So it is not class A address

For option c the first octet is 215 in the form of bits = 11010111 So it is not class A address

For option d the first octet is 255 in the form of bits = 11111111. The first bit of first octet is not 0 so it is also not class A address.

3 0
3 years ago
The ________ is responsible for the Internet's domain name system and the allocation of IP addresses. ICANN W3C ISOC IAB
Maurinko [17]

Answer:

ICANN

Explanation:

It handles the installation and processing of various databases related to network domains and provides a consistent and secure networking service and there are incorrect options are described as follows:

  • IAB, which provides a protocol for managing IETF, is therefore incorrect.
  • W3C is used in web development.
  • ISOC is used to provide Internet access.
7 0
3 years ago
Other questions:
  • If there is no index.html file in the root folder nothing will be displayed when you navigate to the site address
    14·1 answer
  • A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
    14·1 answer
  • During detachment, _____.
    12·2 answers
  • Where do i put the lines?
    11·1 answer
  • Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d
    8·1 answer
  • Which types of scenarios would the NETWORKDAYS function help calculate? Check all that apply.
    15·1 answer
  • All parking revenue comes from a home teams games? True or false
    5·1 answer
  • Alice recently purchased a new cell phone. After her vacation, Alice wanted to transfer her holiday photos to her computer to do
    8·1 answer
  • Anyone want to play mine mincraft w/ me?
    9·1 answer
  • Which is an example of machine-to-machine communication?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!