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
Zolol [24]
3 years ago
12

Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "To

o small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by " seconds". End with a newline.

Computers and Technology
2 answers:
Sati [7]3 years ago
3 0

Answer:

The program to this question as follows:

Program:

#include <iostream> //defining header file

using namespace std;

void PrintPopcornTime(int bagOunces) //defining method PrintPopcornTime that accepts bagOunces

{

//defining conditional statement

if (bagOunces < 3) //if block checks bagOunces less then 3  

{

cout << "Too small"<<endl;

}

else if (bagOunces > 10)

{

cout << "Too large"<<endl; //else if value greater than 10

}

else //else block

{

cout << (bagOunces*6) <<" seconds"<<endl; //calculate seconds

}

}

int main()  

{

int bagOunces; //defining integer variable bagOunces

cout<<"Enter number: "; //message

cin>>bagOunces; //input value by user

PrintPopcornTime(bagOunces); //calling the method

return 0;

}

Output:

Enter number: 3

18 seconds

Explanation:

In the above C++ language code, the first header file is defined, then the method "PrintPopcornTime" is defined, in this method, an integer variable "bagOunces" is passed as a parameter, inside the method a conditional statement is used that can be described as follows:

  • In the if block, it will check that the "bagOunces" variable value is less than 3, if it is true, it will print "Too small". otherwise, it will go else if block.
  • In else if the "bagOunces" variable value is greater then 10, if it is true, it will print "Too large", otherwise it will go else block.
  • In the else block it will calculate the total second and prints its value in new line.

In the next step, the main method is defined, inside this method, an integer variable "bagOunces" is defined, which is used for user input and inside this method, the PrintPopcornTime is called.

charle [14.2K]3 years ago
3 0

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:

You might be interested in
What is the full form of computer​
Annette [7]

Answer:

Common Operating Machine Purposely Used for Technological and Educational Research

Explanation:

4 0
3 years ago
Read 2 more answers
You would like to find the average of cells C2, C3, and C4. What should the formula look like? = C2+C3+C4*3 =C2+C3+C4/3 =(C2+C3+
Marizza181 [45]

Answer:

c3 and c4 and c2 are different and same

Explanation:

average cells are ptoboxide

3 0
4 years ago
Read 2 more answers
Identify the type of error.<br> print "hello"<br><br> num = 5 / 0
horrorfan [7]

Answer:

Syntax error

Explanation:

This is a type of error that occurs when there is a problem with the code that makes it unable to compile and execute.

For example, making a conditional statement without using the correct parameters will result in a syntax error.

4 0
3 years ago
Read 2 more answers
Assume that x is a char variable that has been declared and already given a value. Write an expression whose value is true if an
maria [59]

Answer:

^[A-Fa-f0-9]+$

Explanation:

The hexadecimal (Base 16) can contain 0-9, A-F, a-f and any of these can be the part of the Hexadecimal base 16 code.

In python we have the re.match function, and the syntax is as below:

re.match(pattern, string, flag=0). And we can use this function to check whether the entered char variable is a regex or not. Like:

re.match(pattern,x, flag=0)

8 0
4 years ago
True or false while the internet and social media are vital for spreading campaign messages, television advertisements are consi
liq [111]
Salutations!

The answer is false. Social media, internet, television, are all effective to spread campaigns, news etc. This is the easiest and the fastest way to get information. All these sources are very strong and can reach information any where in the world within minutes.

Hope I helped (:

have a great day!
7 0
4 years ago
Other questions:
  • Why is a cable modem classified as a digital model?
    12·1 answer
  • Which tab would you click to access the autosum feature?
    9·1 answer
  • How to check the balance on a visa gift card?
    6·1 answer
  • How many cells does the organism have?\
    5·2 answers
  • What is the available vector for each resource and the need matrix for each thread. Note that an available vector depicts the qu
    11·1 answer
  • If not cleared out, log files can eventually consume a large amount of data, sometimes filling a drive to its capacity. If the l
    10·2 answers
  • Select the best answer from the drop-down menu.
    14·2 answers
  • Which of the following is a document view you can select using Button on the status bar?
    11·1 answer
  • A security event popped up, alerting security of a suspicious user gaining access to, and copying files from, the %systemroot%\n
    11·1 answer
  • Select examples of software
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!