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
kirill115 [55]
2 years ago
5

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
Computers and Technology
1 answer:
Sladkaya [172]2 years ago
6 0

Answer:

The complete method in cpp is given below.  

void printPopcornTime(int bagOunces)  

{  

if(bagOunces<2)  

cout<<"Too small"<<endl;  

else if(bagOunces>10)  

cout<<"Too large"<<endl;  

else  

cout<<6*bagOunces << " seconds"<<endl;  

}  

The program implementing the above method is given below.  

#include <iostream>  

using namespace std;  

//method declared  

void printPopcornTime(int bagOunces);  

int main() {  

//variable declared  

int bagOunces;  

//variable initialized  

bagOunces = 10;  

//method called which accepts integer parameter  

printPopcornTime(bagOunces);  

//program ends  

return 0;  

}  

//method defined  

void printPopcornTime(int bagOunces)  

{  

//output displayed based on the value of the variable  

if(bagOunces<2)  

cout<<"Too small"<<endl;  

else if(bagOunces>10)  

cout<<"Too large"<<endl;  

else  

cout<<6*bagOunces << " seconds"<<endl;  

}  

OUTPUT1  

60 seconds  

Explanation:

Program explanation is given below.

1. The method, printPopcornTime(), having return type as void and accepting an integer parameter, bagOunces, is declared as shown.  

void printPopcornTime(int bagOunces);  

2. Method declaration only contains return type, method name and parameters taken by the method, if any.  

3. Method definition consists of the complete method. All the code to be written inside the method is also included in its definition.  

4. The method definition for printPopcornTime() is shown in the beginning.  

5. The value of the integer parameter is tested using multiple if-else statements.  

6. The output is based on the value of the parameter. The output is ends with a newline inserted by endl.

7. The main() method has a return type integer and takes no parameters. The main() method is declared and defined together unlike as shown for the other method, printPopcornTime().  

8. The integer variable, bagOunces, is declared and initialized inside main().  

9. This variable is passed as parameter to the printPopcornTime() method and calling the method.  

printPopcornTime(bagOunces);  

10. The program ends with a return statement.  

11. All the results are shown based on the different values of the variable, bagOunces. The original output is obtained when the value of bagOunces is 10.  

12. If the value of bagOunces is 1, the message displayed is shown.  

OUTPUT2  

Too small  

13. If the value of bagOunces is 11, the message displayed is shown.  

OUTPUT3  

Too large  

You might be interested in
Does any of yall know how to delete your account?
il63 [147K]

Answer:

No i really don't but why would you want to delete your account

8 0
2 years ago
When was the idea of the cloud first developed?<br><br> 2000s<br> 1990s<br> 1960s<br> 1980s
kondaur [170]

Answer:I would say 1980 is the answer or The answer is B 1980.

5 0
3 years ago
What do you call when a hacker users multiple guest computers to crack a password?
azamat

Answer: Botnet

Explanation:

Botnet is the process when a hacker user uses multiple guest computer to crack a password. Basically, hackers use botnet for performing the distributed denial of services attack in the network.

It also steal the data and allowed attacker to approach its connection and access its device.

Botnet word is the combination of robot and network and botnet can be controlled by using the command and control software.

6 0
3 years ago
We are learning about raspberry pi in my class and I don't know the answers to these two questions
Reptile [31]
Answer: no idea





Explanation:
8 0
3 years ago
Describe como es el movimiento de un volantín
Maksim231197 [3]

Answer:

Lift is generated by differences in air pressure, which are created by air in motion over the body of the kite. Kites are shaped and angled so that the air moving over the top moves faster than the air moving over the bottom. ... Thrust is the forward force that propels a kite in the direction of motion

Explanation:

8 0
2 years ago
Other questions:
  • The checksum doesn't compute for a packet sent at the Internet Protocol (IP) level. What will happen to the data?
    14·1 answer
  • Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named depart
    14·1 answer
  • A computer emergency response team is called at midnight to investigate a case in which a mail server was restarted. After an in
    8·1 answer
  • In which situation will file compression be required to complete the task
    15·1 answer
  • Which are advantages of using a server operating system?
    12·1 answer
  • What is the effect of block size in cache design?
    12·1 answer
  • 1 There are several applications to assist you to surf through the internet, mention
    13·1 answer
  • In the last two decades, how have cameras evolved?
    12·2 answers
  • Why do people make Among Us games on Ro-blox, and thousands of people play them, when Among Us is free on all devises?
    10·1 answer
  • Chang is a network engineer. He is revising the company's firewall implementation procedure. As part of this work, he is reviewi
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!