Answer to Question #328592 in C++ for Program Training

Question #328592

Complete function 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 = 7: 


42 seconds


1
Expert's answer
2022-04-15T16:36:34-0400


#include<iostream>




using namespace std;


void PrintPopcornTime(int bagOunces){
	if(bagOunces<2){
		cout<<"Too small\n\n";
	}else if(bagOunces>10){
		cout<<"Too large\n\n";
	}else{
		cout<<(6*bagOunces)<<" seconds\n\n";
	}
} 


int main(){
	int bagOunces;
	cout<<"Enter bagOunces: ";
	cin>>bagOunces;




	PrintPopcornTime(bagOunces);
	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS