Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Add exception handling to a Tip Calculator program. 

Console

Tip Calculator

INPUT

Cost of meal: ten

Must be a valid decimal number. Please try again.

Cost of meal: -10

Must be greater than 0. Please try again.

Cost of meal: 52.31

Tip percent: 17.5

Must be a valid integer. Please try again.

Tip percent: 20

OUTPUT

Cost of meal: 52.31

Tip percent: 20%

Tip amount: 10.46

Total amount: 62.77

Specifications

  • The program should accept decimal entries like 52.31 and 15.5 for the cost of the meal.
  • The program should accept integer entries like 15, 20, 25 for the tip percent.
  • The program should validate both user entries. That way, the user can't crash the program by entering invalid data.
  • The program should only accept numbers that are greater than 0.
  • The program should round results to a maximum of two decimal places.

This program need to run with python

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92772982
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Sorted golf scores - need flowchartdesign a program that

Sorted Golf Scores - need flowchart Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents. Looking for "" ...

Briefly explain what separations are how do they effect the

Briefly explain what separations are, how do they effect the average duration of unemployment?

Question 1you want a list of products whose product lines

Question 1 You want a list of products whose product lines contain the term  Classic  or  Vintage.  please pick up best option from the following. a. SELECT productline FROM products WHERE MATCH(productline) AGAINST('Cla ...

Sales bar chartwrite a program that asks the user to enter

Sales Bar Chart Write a program that asks the user to enter today's sales for 5 stores. The program should then display a bar graph comparing each store's sales. Create each bar in the bar graph by displaying a row of as ...

Please respondwhat are some other ways to troubleshoot

PLEASE RESPOND What are some other ways to troubleshoot reduced speed or latency? Or to find out what is using all the bandwidth? Perhaps might incorporate parts of this into own three issues.

Explain that the biggest problems with adware is that it

Explain that the biggest problems with adware is that it slows down the computers its running on.

What is the difference between dekkers algorithm and igloo

What is the difference between Dekkers Algorithm and Igloo approach? Please provide examples that can explain this.

Determine the number of moles of oleic acid in the

Determine the number of moles of oleic acid in the monolayer. Assume the nubmer of grams of oleic acid in the monolayer is  7.12×10 -6  g MW for oleic acid is 282 g/mol.

Suppose the probability density function for a random

Suppose the probability density function for a random variable X equals the following:  f(x) = cx 3  for {0 (a) Solve for the value of "c" that makes this a valid pdf. (Hint: please refer to the two necessary conditions ...

Subject economicsa manager has a utility function u c 05

Subject: Economics A manager has a utility function U = C 0.5 if she doesn't work hard and U = C 0.5 - 3 if she does. Expected profit will increase from 1,000 to 1,500 if she works hard. The manager receives compensation ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As