Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help creating this program in pseudocode - Assume that hot dogs come in p

ID: 3797865 • Letter: I

Question

I need help creating this program in pseudocode - 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

Explanation / Answer

Pseudo Code:

X = Enter the no of people

M = Enter the No of hot dogs per person

The minimum number of packages of hot dog required = Y(Buns) (ONLY Quotient and excluding decimal part) = (X / 8) + 1
The number of buns that will be left over = Y(r) = 8 - (X Mod 8)

The minimum number of packages of buns required = Z(HD) (ONLY Quotient and excluding decimal part)= ((X * M) / 10) + 1
The number of hot dogs that will be left over = Z(r) = 10 - ((X * M) Mod 10)

The above is the pseudo code for the asked question.

Lets study this code by considering an example say

Example

Hot Dogs - Z
Buns - Y

X = Enter the no of people = say 227

M = Enter the No of hot dogs per person = say 3

The minimum number of packages of hot dog required = Y(Buns) (ONLY Quotient and excluding decimal part) =

(X / 8) + 1

= (227/8) + 1 = 29

The number of buns that will be left over = Yr = 8 - (X Mod 8) = 8 - (227 % 8) = 3

The minimum number of packages of buns required = Z(HD) (ONLY Quotient and excluding decimal part)=

((X * M) / 10) + 1

= ((227 * 3) / 10) + 1 = 69

The number of hot dogs that will be left over = Zr = 10 - ((X * M) Mod 10)

= 10 - ((227 * 3) % 10) = 9.

The above example explains you theoretically the minimum amount of hot dogs/buns required and the residues.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote