Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is about exception handling. In Lab 02 we wrote a program for a hotdog stand to calculate total amount due from a customer.

This program is about exception handling. In Lab 02 we wrote a program for a hotdog stand to calculate total amount due from a customer. We want to add exception handling to the program. The 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 $2.50

Please write code in pycharm or something similar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

Students also viewed these Databases questions

Question

Calculate 0 and 1 for

Answered: 1 week ago