Display an error message and set the number of that item

Assignment Help Python Programming
Reference no: EM132356101

Question

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

Reference no: EM132356101

Questions Cloud

Organizational design and your assessment of effectiveness : Introduction of organization you chose, including history and background. The organizational design and your assessment of the effectiveness.
Develop environmental analysis that includes competitive : Develop an environmental analysis that includes competitive, economic, political, legal, technological, and sociocultural forces.
Make a program that stores employee objects in a dictionary : Compose a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title.
Report on research design and methodology : HI6008 Business Research Project - Report on Literature Review (including statement of ‘who wrote which sections)
Display an error message and set the number of that item : 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.
BREITT-STARR and DIAMOND LLC : Read and complete the case study titled, "BREITT, STARR & DIAMOND LLC."
Find and display the union of set1 and set2 : Generate 5 random integers between 1 and 10, inclusive. Store the random integers in another set named set2. Display the set.
Name a list to store the letters that are in the dictionary : Ask the user to enter a string. Convert all letters to uppercase. Count the frequency of each letter in the string. Store the frequency counts in a dictionary.
Design the network requirements for the ABC Company : ISY202 - Information Systems Networking Essentials Assignment, Australian Institute of Higher Education, Australia

Reviews

Write a Review

Python Programming Questions & Answers

  Find and display the account balances

Display account number and balance for all customers - Search and display the accounts which have balance equal to the given balance

  Function by sum of sines

code the program using an editor (DO NOT COMMAND LINE THE PROGRAM) and show the results

  Define what string operations are available

Define what string operations are available and how you use them

  Takes a directory containing files that record

Create a program called grading.py that takes a directory containing files that record how student's performed on their assignments and from these files determines each students grades in addition to the course statistics.

  Write Python code to control operations on virtualized Cisco

For your APIC-EM Software project, you will be writing Python code to access and control operations on a virtualized Cisco APIC-EM controller

  Write a function that given a list of numbers returns true

Write a function that given a list of numbers, returns the length of the longest sequence of numbers within that list that forms an arithmetic progression.

  Project - expand the simulation with a class hierarchy

Project: Expand the Simulation with a Class Hierarchy. Purpose: Expand classes into a hierarchy. Introduce a View to the Model-View-Controller design pattern. Provide more functionality to the simulation

  Write a python program that allows the user to enter

Write a Python program that allows the user to enter a series of numbers and places the numbers (not string values) in a list.

  Implement key exchange using the diffie-hellman algorithm

Implement key exchange using the Diffie-Hellman algorithm, when peer- to-peer connections are made between bots and achieve confidentiality through encryption of the client-server commu- nications with an appropriate block or stream cipher.

  Add a list to keep track of all the numbers guessed

Add a list to keep track of all the numbers guessed and modularize your code. Be sure to import random at the beginning of your code.

  Calculate and show the sum and max of those numbers

Ask the user to enter X numbers into a list. Put those numbers into a list, and show the list. Calculate and show the sum, average, min, max of those numbers.

  Create a new file in your repository

Create four functions, sequential search, ordered sequential search, binary search_iterative and binary search_recursive, and use the code from the section

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd