1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Reil [10]
4 years ago
5

Write a Python program to calculate tax and tip. Ask the user for a check amount, and calculate the tax and tip, providing tip a

mounts for stingy, regular, and generous customers. Use the following steps:
Prompt the user for a check amount and store it in a variable called check_amount_str.
Convert check_amount_str to a floating point number and store it in a variable called check_amount.
Calculate tax amount (7%) and three tip amounts (10%, 15%, and 20%), storing each result in a separate variable.
Calculate total for regular customers including 7% tax and 15% tip. Print the results to the console like in the example below, including the base cost of the meal, tax, three tip levels, and total for regular customers.

The expected output from your program should look like the following:
Please enter check amount: $ 20
Base cost: $ 20.00
Tax (7 %): $ 1.40
Tip for stingy customers (10 %): $ 2.00
Tip for regular customers (15 %): $ 3.00
Tip for generous customers (20 %): $ 4.00
Total with tax and tip for regular customers: $ 24.40

Note: that it’s okay for now if you have more decimals, e.g. your total might look like $ 24.40000001. We will learn how to format your output later.

Computers and Technology
1 answer:
ICE Princess25 [194]4 years ago
5 0

Answer:

check_amount = float(input("Please enter check amount: "))

print('Base cost: $ {}'.format(check_amount))

tax = (7/100)*check_amount

print('tax at 7% is $ {}'.format(tax))

tipStingy = (10/100)*check_amount

tipRegular = (15/100)*check_amount

tipGenerous= (20/100)*check_amount

print('Tip for stingy customers (10 %): ${}'.format(tipStingy))

print('Tip for Regular customers (15 %): ${}'.format(tipRegular))

print('Tip for generous customers (20 %): ${}'.format(tipGenerous))

print('Total with tax and tip for regular customers: ${}'.format(check_amount+tax+tipRegular))

Explanation:

Find the screenshot of code output  attached.

The variable check_amout is received with the input function and converted to a floating point number by casting to float

All the other variables are computed as percentages of this variable

Python's .format method is used with the print function for output as required

You might be interested in
​Eamon wants to provide a discount to premium buyers who order in large quantities. He wants to create a code for each price and
SCORPION-xisa [38]

Answer:

The correct answer for the following question will be A. Cipher code.

Explanation:

Cipher code:

Ciphers are potentially the cryptographic central pillar. A cipher is usually an algorithm to perform both encryption and decryption.

Secret key encryption relies on the use of symmetric ciphers. Whether the goal is to convert plaintext to ciphertext and vice-versa. The secret key is shared on both ends, and the person having the secret key can only encrypt and decrypt the data.

So, option A is a suitable answer.

3 0
4 years ago
Which command is used to combine two or more cells together into one cell?
Tju [1.3M]
B is your answer I believe
5 0
3 years ago
Read 2 more answers
Whats a field in databases?
SVETLANKA909090 [29]
A field is a single attribute of an entity, object or event.
3 0
3 years ago
Which of the following terms are aspect ratios for devices? 'select all that apply
Viktor [21]

Answer:

1080 x 1920

800 x 600

Explanation:

These are the screen sizes that you can find in the list of the screen sizes, which can be easily found in the document that lists all the screen sizes. You will certainly find the 1080 x 1920 and also the 800 x 600, however, you will not find the 320 x 240 and 800 x 600. The last two are the standard screen sizes and hence are not the correct options. The correct options are as listed above.

3 0
4 years ago
What is the advantages and disadvantages of hardware devices and software devices ?
yulyashka [42]

Answer:

Advantages of hardware:

Physical existence

Multitasking

Speedy

Disadvantages:

Costly as different equipment cost differently

Time consuming

requires space

Privacy issues

Explanation:

Advantages of Software:

Less costly

Improved privacy controls

Requires no space

Disadvantages:

Does not have physical existence

hacking and cyber attacks may steal important information

Regular updates required

3 0
3 years ago
Other questions:
  • What is it called when you want to automatically create columns that are the same length in a newsletter?
    7·1 answer
  • Which printout will result from the snippet of code?
    9·1 answer
  • The field on which records are sorted is called the composite primary key.A. TrueB. False
    12·1 answer
  • Which of the following is a set of short-range wireless technologies used to share information among devices within about two in
    8·1 answer
  • Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe
    13·1 answer
  • A. Choose the correct answer.
    8·2 answers
  • Write a paragraph discussing privacy issues on the internet<br> and their impact on human lives.
    9·1 answer
  • Which of the following terms means the computer operating system automatically detects and installs the proper driver for a new
    9·1 answer
  • Write its features:features of computer ​
    15·1 answer
  • Consider an allocator that uses an implicit free list. The layout of each allocated and free memory block is as follows: 31 210
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!