Answered

Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, 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 = 7:

Answer :

ohismike24

Answer:

#include <iostream>

using namespace std;

void PrintPopcornTime(int bagOunces) {

if(bagOunces < 3){

 cout << "Too small";

 cout << endl;

}

else if(bagOunces > 10){

 cout << "Too large";

 cout << endl;

}

else{

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

}

}

int main() {

  PrintPopcornTime(7);

  return 0;

}

Explanation:

Using C++ to write the program. In line 1 we define the header "#include <iostream>"  that defines the standard input/output stream objects. In line 2 "using namespace std" gives me the ability to use classes or functions, From lines 5 to 17 we define the function "PrintPopcornTime(), with int parameter bagOunces" Line 19 we can then call the function using 7 as the argument "PrintPopcornTime(7);" to get the expected output.

Other Questions