View the step-by-step solution to:

This program is about exception handling. A hotdog stand sells hotdogs, potato chips and sodas. Hotdogs are $2.50 each. Potato chips are $1.50 per...

This program is about exception handling. A hotdog stand sells hotdogs, potato chips and sodas. Hotdogs are $2.50 each. Potato chips are $1.50 per bag. Sodas are $1.25 per can. The program asks the user to enter number of hotdogs, chips and sodas ordered by the customer. It calculates and displays the total amount due. Numbers of hotdogs, chips and sodas entered should be integers. If the user enters anything that cannot be converted to an integer, display an error message and set the number of that item to 0. For example, if the user enters 3.5 hotdogs, display "Invalid input. Number of hotdogs must be an integer" and set number of hotdogs to 0. Do not ask the user to reenter number of hotdogs.


The following an example:


How many hotdogs? 3.5

Invalid input. Number of hotdogs set to 0.

How many bags of chips? two

Invalid input. Number of chips set to 0.

How many cans of sodas? 2

Please pay this amount: 2.5

Top Answer

Sample Output of the program is as follows: How many hotdogs? 3.5 Invalid input. Number of hotdogs set... View the full answer

Capture.PNG

Sign up to view the full answer

Other Answers

Please find the logic below for the program, Let me know if you have any doubts. total_cost= 0 #to store total cost of the... View the full answer

output.PNG

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online