Book Starting out with Programming Logic and Design 4th Edit

Book: Starting out with Programming Logic and Design 4th Edition by Tony Gaddis

Chapter 3 Programming Exercise #11

Hot Dog Cookout Calculator

Assume that hot dogs come in packages of 10, and hot dog buns come in packages of 8. Design a modular program that calculates the number of packages of hot dogs and the number of packages of hot dog buns needed for a cookout, with the minimum amount of leftovers. The program should ask the user for the number of people attending the cookout, and the number of hot dogs each person will be given. The program should display the following:

The minimum number of packages of hot dog required

The minimum number of packages of buns required

The number of hot dogs that will be left over

The number of buns that will be left over

Solution

#include using namespace std; int main() { int nop,nohd,no_of_buns,no_of_hotdogs; cout<<\"enter the number of persons visiting : \"; cin>>nop; cout<<\"\ enter no of hotdogs each person will be given :\"; cin>>nohd; int temp=(nohd*nop)%10; if(temp==0) { no_of_hotdogs=(nohd*nop)/10; } else no_of_hotdogs=(nohd*nop)/10 + 1; temp=nohd/8; if(temp==0) { no_of_buns=(nohd*nop)/8; } else no_of_buns=(nohd*nop)/8 + 1; cout<<\"\ the minimum number of hotdogs to be ordered is \"<
Book: Starting out with Programming Logic and Design 4th Edition by Tony Gaddis Chapter 3 Programming Exercise #11 Hot Dog Cookout Calculator Assume that hot do

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site