Question

Calculating Charges - Part 2 Calculate the mileage charge Depending on the rental type, the mileage...

Calculating Charges - Part 2

  1. Calculate the mileage charge
  2. Depending on the rental type, the mileage charge is calculated differently. You will need to create additional code to calculate the mileage charge for each type of rental. Store the cost of miles driven as the variable mileCharge

    Set the user input equal to rentalCode.

    rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
    
    1. Prompt the user to input the Rental Code.

      Prompt: "(B)udget, (D)aily, or (W)eekly rental?\n"
      Variable: rentalCode = ?

    2. Code B (budget) mileage charge: $0.25 for each mile driven

      mileCharge = totalMiles x 0.25

    3. Code D (daily) mileage charge: no charge if the average number of miles driven per day is 100 miles or less;
      1. Calculate the averageDayMiles = totalMiles/rentalPeriod
        1. If averageDayMiles is 100 or less,

          extraMiles = 0

          If averageDayMiles is above the 100 mile per day limit, calculate:

          extraMiles = averageDayMiles - 100

        2. Calculate the cost of the extra miles:

          extraMiles x $0.25

      2. Code `W` (weekly) mileage charge: no charge if the average number of miles driven per week is 900 miles or less.
        1. Calculate the average weekly miles

          averageWeekMiles = totalMiles/ rentalPeriod

        2. If the average number of miles driven per week exceeds 900 miles, the mileCharge is $100.00 per week, otherwise, the mileCharge is $0.00
      3. Test your code.

Homework Answers

Answer #1

Answer: Hey! Kindly find your code here. If you have any queries, feel free to ask me, would be very happy to solve them. You didn't mention any language so I used pythonThanks.

print("Rental Code")
print("B-(Budget),D(Daily),W(Weekly)")
totalMiles = float(input("Enter total miles"))
rentalPeriod = float(input("Enter period of rental"))
averageDayMiles = totalMiles/rentalPeriod
averageWeekMiles = totalMiles/rentalPeriod
rentalCode = input("Enter rental code: ")
if rentalCode =="B":
   mileCharge = totalMiles*0.25
   print("Your mile charge is: $",mileCharge)
elif rentalCode == "D":
   if averageDayMiles<=100:
       extraMiles = 0
       print("You have no charge")
   else:
       extraMiles = averageDayMiles-100
       mileCharge = extraMiles*0.25
       print("Your mile charge is: $",mileCharge)
elif rentalCode =="W":
   if averageWeekMiles<=900:
   mileCharge = 0
   print("Your mile charge is: $",mileCharge)
     
   else:
       mileCharge = 100
       print("Your mile charge is: $",mileCharge)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Introduction Your task for this project is to create a very simple rental car cost estimator....
Introduction Your task for this project is to create a very simple rental car cost estimator. The project is broken into three sections: Collect customer input Calculate the costs from the customer input Display the results to the customer Your final output should look like this: Rental Code: D Rental Period: 5 Starting Odometer: 1234 Ending Odometer: 2222 Miles Driven: 988 Amount Due: $324.40 _______________________________________ Section 1-1: import sys ''' Section 1: Collect customer input ''' ##Collect Customer Data -...
CSE 231                                         &n
CSE 231                                                                                                                        Fall 2019 Project #2 ## Language Should be Python. Assignment Specifications The program will compute and display information for a company which rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customer’s vehicle rental. The program should start by asking the user if he wants to continue. The answer is ‘Y’ for yes or ‘N’ for no. You can check the value with Boolean expressions such...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you will demonstrate how to create an HTML file, externally link a JavaScript file, and write some source code in the JavaScript file. a..Create two blank files to be an HTML file and a JavaScript file. The file names should be partA.html and partA.js. b.. Create a basic HTML webpage structure. c..Link the JavaScript file to the HTML file using the <script> tag. d.. Prompt...
6.3 Lab Lesson 3 (Part 3 of 3) Part of lab lesson 3 There are three...
6.3 Lab Lesson 3 (Part 3 of 3) Part of lab lesson 3 There are three parts to lab lesson 3. The entire lab will be worth 100 points. Bonus points for lab lesson 3 There are also 10 bonus points. To earn the bonus points you have to complete the Participation Activities and Challenge Activities for zyBooks/zyLabs unit 5 (Gaddis Chapter 3). These have to be completed by the due date for lab lesson 3. For example, if you...
Program Description A local company has requested a program to calculate the cost of different hot...
Program Description A local company has requested a program to calculate the cost of different hot tubs that it sells. Use the following instructions to code the program: File 1 - HotTubLastname.java Write a class that will hold fields for the following: The model of the hot tub The hot tub’s feature package (can be Basic or Premium) The hot tub’s length (in inches) The hot tub’s width (in inches) The hot tub’s depth (in inches) The class should also...
Pallets of Cake Mix Demanded Probability Cumulative Probability Fewer than 2 0.10 0.10 2 0.30 0.40...
Pallets of Cake Mix Demanded Probability Cumulative Probability Fewer than 2 0.10 0.10 2 0.30 0.40 3 0.55 0.95 4 0.04 0.99 5 0.007 0.997 6 0.003 1.00 Sum: 1 Just Baked grew from one retail store in 2009 to thirteen stores in early 2013. Demand for cupcakes exhibits patterns based on seasons, store location, day of the week, and time of day. The "freshness promise" implicit in the name Just Baked has to be supported by the daily baking...
6.7 The production function Q=KaLb where 0≤ a, b≤1 is called a Cobb-Douglas production function. This...
6.7 The production function Q=KaLb where 0≤ a, b≤1 is called a Cobb-Douglas production function. This function is widely used in economic research. Using the function, show the following: a. The production function in Equation 6.7 is a special case of the Cobb-Douglas. b. If a+b=1, a doubling of K and L will double q. c. If a +b < 1, a doubling of K and L will less than double q. d. If a +b > 1, a doubling...
23. In the perfectly competitive model, what kind of products are all firms assumed to be...
23. In the perfectly competitive model, what kind of products are all firms assumed to be producing? a. identical products b. differentiated products c. well-advertised products d. unique products 27. Under what circumstance will a firm in a perfectly competitive industry expand output? a. when marginal cost is less than marginal revenue b. when marginal revenue is less than average revenue c. when marginal revenue is less than average total cost d. when marginal cost is less than average total...
1 Over the past several years, the proportion of one-person households has been increasing. The Census...
1 Over the past several years, the proportion of one-person households has been increasing. The Census Bureau would like to test the hypothesis that the proportion of one-person households exceeds 0.27. A random sample of 125 households found that 43 consisted of one person. The Census Bureau would like to set α = 0.05. Use the critical value approach to test this hypothesis. Explain. 2 Organizations are relying more and more on social-networking sites to research job candidates. According to...
I completed everything except for the last part. I know my answers are right because i...
I completed everything except for the last part. I know my answers are right because i double checked but i just dont know how to answer the last section. Problem 3-1 Schedule C (LO 3.1) Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is located at 678 Third Street, Riverside, CA 92860. Scott’s income statement for the year...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT