Ask Question
2 January, 18:49

Mileage Calculator You are tasked with creating a mileage caclulator to calculate the amount of money that should be paid to employees. The mileage is computed as follows An amount of. 25 for each mile up to 100 miles An amount of. 15 for every mile above 100. So 115 miles would be (.25 * 100) (.15 * 15) This can all be coded using a mathematical solution but I want you to use an if / else statement. Here is how you are to implement it: If the total miles input is less than or equal to 100 then simply calculate the miles *.25 and output the amount otherwise compute the total amount for all miles mathematically. Input: Total number of miles Process: dollar amount owed for miles driven Output: Amount of money due

+4
Answers (1)
  1. 2 January, 19:34
    0
    mileage = float (input ("Enter mileage: ")) if (mileage > 100) : amount = (mileage - 100) * 0.15 + 100 * 0.25 else: amount = mileage * 0.25 print ("Total amount: $" + str (amount))

    Explanation:

    The solution code is written in Python 3.

    Firstly, prompt user to input a mileage (Line 1).

    Next, create an if statement to check if a mileage greater than 100 (Line 3). If so, apply the formula to calculate amount with mileage above 100 (Line 4) otherwise, calculate the amount just by multiplying the mileage by 0.25.

    At last, print the total amount (Line 8).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Mileage Calculator You are tasked with creating a mileage caclulator to calculate the amount of money that should be paid to employees. The ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers