Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Python code for the following tasks. a) Ask the user for the subtotal of a bill and the gratuity rate. The gratuity rate must

Write Python code for the following tasks.

a) Ask the user for the subtotal of a bill and the gratuity rate. The gratuity rate must be input as a whole number. Compute the amount of gratuity and total of the bill assuming a tax rate of 8% applied to the. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 for the gratuity amount, and $12.3 (10 + 10*.08 + 1.5) for the grand total. Choose descriptive variable names. Make sure to display all data (both what is input to the program and what the program calculates). Clearly explain the output. Dont just display a value. For example, instead of displaying 800 for a given monetary value, display something like: value = $800.

b) Ask the user to input the weight of a person in pounds, the height in feet and inches, and calculate the BMI. The simple formula to calculate the BMI is: BMI = weight in pounds * 703 / (height in inches * height in inches) So, you need to convert the feet portion of the height to inches by multiplying it by 12 and add it to the height in inches portion to get the height in inches. For example, for a person who is 5 feet 8 inches tall and weighs 160 pounds, the BMI = 160 * 703 / (68*68) = 24.32 which happens to be normal. Do you see how I arrived at 68? 5*12 + 8 is 68! If you pick descriptive variable names (a requirement for this class), your programming life would be much easier. Clearly explain the output. Dont just display a value.

c) Ask the user for a temperature reading measured in degrees Celsius and covert it to degrees Fahrenheit. The simple formula is: Fahrenheit = 9/5 * Celsius + 32. For example, 100 degrees Celsius is the same as 212 degrees Fahrenheit. Clearly explain the output.

d) Ask the user for a temperature reading measured in degrees Fahrenheit and convert it to degrees Celsius. The simple formula is: Celsius = (Fahrenheit 32) * 5/9. For example, 212 degrees Fahrenheit is 100 degrees Celsius. Clearly explain the output.

e) A Lawn service provider has three types of services: mowing, fertilizing, and planting trees. The cost of mowing is 1.25 (or .0125 dollars) cents per square yards, fertilizing is $25 per application, and planting a tree is $40. Ask the user to enter the length and width (in yards) of the lawn, tax rate (as a whole number) and the number of trees to be planted. Hope the calculation is NOT very difficult! Calculate the area (hope you know how do this!). Calculate and display the billing amount in dollars. Add tax and display the calculated tax value and display the total bill with tax in dollars. Clearly explain the output.

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

How are values illustrated in the case?

Answered: 1 week ago

Question

Describe S. Truett Cathys self-concept and self-efficacy.

Answered: 1 week ago