52.8k views
2 votes
Hot Dog Cookout Calculator Assume hot dogs come in packages of 10, and hot dog buns come in packages of 8. Write a 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 details: 1. The minimum number of packages of hot dogs required 216.2. The minimum number of packages of hot dog buns required.3. The number of hot dogs that will be left over.4. The number of hot dog buns that will be left over.

1 Answer

6 votes

Answer:

Following are the code to this question:

person= int(input("Input the value who attend the cookout: "))#defining a variable person for input value

Given_hotdog = int(input("Input the value of hotdog, that each person will take: "))#defining a variable Given_hotdog for input value

hotdogs = person* Given_hotdog #calculating the total value of hotdogs

# calculating the numbers of the package, that holds require hotdog and buns

package_hotdog=int(hotdogs/10)+1# calculating hotdog packages

bun_package=int(hotdogs/8)+1# calculating buns package

left_hotdogs= package_hotdog*10 -hotdogs# calculating left hotdogs

left_buns=bun_package*8-hotdogs# calculating left buns

print("Total Hotdogs",hotdogs)#print total hotdogs value

print("The Minimum number of packages require for hotdogs: ", package_hotdog)#print require hotdogs value

print("The Minimum number of packages require for buns: ", bun_package)#print require buns value

print("Number of left hotdogs: ", left_hotdogs)#print left hotdogs value

print("Number of left buns: ", left_buns)#print left buns value

Output:

please find the attached file.

Step-by-step explanation:

In the above-given code, the "person and Given_hotdog" variable is declared, which is used to take input from the user end and in the "hotdogs" variable we calculate its total value.

  • In the next step, "package_hotdog and bun_package" is declared, which uses the "hotdogs" variable to calculate its value.
  • At the last step, the "left_hotdogs and left_buns" variable is declared, which uses the above variable for calculating the value and use the print method to print its value.
Hot Dog Cookout Calculator Assume hot dogs come in packages of 10, and hot dog buns-example-1
User Pavel Uvarov
by
5.0k points