Question

BELOW CODE DONE IN CODIO AND PASSED THE FIRST SET OF CHECKS FOR COLLECT CUSTOMER DATA...

BELOW CODE DONE IN CODIO AND PASSED THE FIRST SET OF CHECKS FOR COLLECT CUSTOMER DATA PART 2 (CODIO)
CHECK INSTRUCTIONS BELOW - PASSED

Collect Customer Data - Part 2

  1. Collect Mileage information:

    Prompt: "Starting Odometer Reading:\n"

    Variable: odoStart = ?

    Prompt: "Ending Odometer Reading:\n"

    Variable: odoEnd = ?

    Add code to PRINT odoStart and odoEnd variables as well as the totalMiles to check your work.

    The following data will be used as input in the test:

    odoStart = 1234
    odoEnd = 2222
    

    Collect Customer Data - Part 2 - Feedback Link

    IF you would like some constructive feedback on your assignment before you submit for a grade, press the Help Me! button below.

    Help Me!

    Customer Data Check 2

    In your rental_car.py file, add code to print out the two new variables you have collected input for:
    odoStart
    odoEnd
    totalMiles

    Check It!

    LAST RUN on 7/21/2019, 1:32:55 AM

     

    Check 1 passed

    1. Prompt the user to input the starting odometer reading (expect type int from the user)
    2. Prompt the user to input the ending odometer reading (expect type int from the user)
    3. Test your code.

BELOW IS CODE THAT PASSED COLLECT CODIO CUSTOMER DATA CHECKS PART 2 BUT HAS FAILED CODIO CALCULATING CHARGES PART 2

#Add customer input 1 here, rentalCode = ?
rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
print (rentalCode)
#Collect Customer Data - Part 2
#4)Collect Mileage information:
#a) Prompt the user to input the starting odometer reading and store it as the variable odoStart


#Prompt -->"Starting Odometer Reading:\n"
# odoStart = ?

odoStart = input('Starting Odometer Reading: ')

#b) Prompt the user to input the ending odometer reading and store it as the variable odoEnd
#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?
odoEnd = input('Ending Odometer Reading: ')

#c) Calculate total miles
totalMiles = int(odoEnd) - int(odoStart)

#Print odoStart, odoEnd and totalMiles

print (odoStart)
print (odoEnd)
print (totalMiles)

# Calculate Charges 2

## Calculate the mileage charge and store it as
# the variable mileCharge:

#a) Code 'B' (budget) mileage charge: $0.25 for each mile driven
if rentalCode == "B" or rentalCode=='b':
mileCharge = totalMiles * 0.25

#b) Code 'D' (daily) mileage charge: no charge if the average
# number of miles driven per day is 100 miles or less;
# i) Calculate the averageDayMiles (totalMiles/rentalPeriod)
elif rentalCode == "D" or rentalCode=='d':
rentalPeriod = int(input('Enter days rented: '))
averageDayMiles = totalMiles/rentalPeriod
if averageDayMiles <= 100:
  
# ii) If averageDayMiles is above the 100 mile per day# limit:
# (1) calculate extraMiles (averageDayMiles - 100)
else:
# (2) mileCharge is the charge for extraMiles, # $0.25 for each mile
mileCharge = (averageDayMiles-100) *0.25

#c) Code 'W' (weekly) mileage charge: no charge if the
# average number of miles driven per week is
# 900 miles or less;
elif rentalCode == 'W' or rentalCode=='w':
rentalWeek = int(input('Enter rental week: '))
averageWeekMiles = totalMiles / rentalWeek
if averageWeekMiles<=900:
  
else:
mileCharge=100*rentalWeek
print('Charges : ${}'.format(mileCharge))

BELOW IS THE CODIO CHECK FOR CALCULATING CHARGES PART 2 - CHECK FAILED

Failing in line 45-47-indentation error need fix

INSTRUCTIONS

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 mileChargeis $100.00 per week, otherwise, the mileCharge is $0.00
      3. Test your code.

    Add code to PRINT the mileCharge to check your work.

    The following data will be used as input in the test:

    rentalCode = 'B'
    odoStart = 1234
    odoEnd = 2222
    

    Calculate Charges - Final - Feedback Available

    If you would like some feedback on this part of your project before you attempt the next part, click on the Help Me! button below.

    Help Me!

    LAST RUN on 7/21/2019, 1:20:35 AM

     

    Show Feedback

    Calculation Check 2A

    Add to your script to print the value of the variable mileCharge for greater than a hundred miles

    Check It!SHOW DIFF

    LAST RUN on 7/21/2019, 1:24:34 AM

     
    Check 1 failed
    Output:

    File "rental_car-customer-data-2.py", line 45 else: ^ IndentationError: expected an indented block

    Expected:

    (B)udget, (D)aily, or (W)eekly rental? B Starting Odometer Reading: Ending Odometer Reading: 1234 2222 988 247.00

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Updated code

#Add customer input 1 here, rentalCode = ?
rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
print (rentalCode)
#Collect Customer Data - Part 2
#4)Collect Mileage information:
#a) Prompt the user to input the starting odometer reading and store it as the variable odoStart


#Prompt -->"Starting Odometer Reading:\n"
# odoStart = ?

odoStart = input('Starting Odometer Reading: ')

#b) Prompt the user to input the ending odometer reading and store it as the variable odoEnd
#Prompt -->"Ending Odometer Reading:"
# odoEnd = ?
odoEnd = input('Ending Odometer Reading: ')

#c) Calculate total miles
totalMiles = int(odoEnd) - int(odoStart)

#Print odoStart, odoEnd and totalMiles

print (odoStart)
print (odoEnd)
print (totalMiles)
# Calculate Charges 2

## Calculate the mileage charge and store it as
# the variable mileCharge:

#a) Code 'B' (budget) mileage charge: $0.25 for each mile driven
if rentalCode == "B" or rentalCode=='b':
mileCharge = totalMiles * 0.25

#b) Code 'D' (daily) mileage charge: no charge if the average
# number of miles driven per day is 100 miles or less;
# i) Calculate the averageDayMiles (totalMiles/rentalPeriod)
elif rentalCode == "D" or rentalCode=='d':
rentalPeriod = int(input('Enter days rented: '))
averageDayMiles = totalMiles/rentalPeriod
if averageDayMiles <= 100:
mileCharge=0
# ii) If averageDayMiles is above the 100 mile per day# limit:
# (1) calculate extraMiles (averageDayMiles - 100)
else:
# (2) mileCharge is the charge for extraMiles, # $0.25 for each mile
mileCharge = (averageDayMiles-100) *0.25

#c) Code 'W' (weekly) mileage charge: no charge if the
# average number of miles driven per week is
# 900 miles or less;
elif rentalCode == 'W' or rentalCode=='w':
rentalWeek = int(input('Enter rental week: '))
averageWeekMiles = totalMiles / rentalWeek
if averageWeekMiles<=900:
mileCharge=0
else:
mileCharge=100*rentalWeek
print('Charges : ${}'.format(mileCharge))

output

code snaps for indetation

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
BELOW CODE DONE IN CODIO AND PASSED THE FIRST SET OF CHECKS FOR COLLECT CUSTOMER DATA...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • what am I missing? this should be the output: (B)udget, (D)aily, or (W)eekly rental? B Starting...

    what am I missing? this should be the output: (B)udget, (D)aily, or (W)eekly rental? B Starting Odometer Reading: Ending Odometer Reading: 1234 2222 988 247.00 my output is this: (B)udget, (D)aily, or (W)eekly rental? Starting Odometer Reading: Ending Odometer Reading: 1234 2222 988 247.00 here's my code so far: import sys ''' Section 1: Collect customer input ''' #Add customer input 1 here, rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?") #Collect Customer Data - Part 2 #4)Collect Mileage information: ##a)...

  • Section 1: Collect customer input ''' rentalCode = input('(B)udget, (D)aily, or (W)eekly rental?\n') if rentalCode ==...

    Section 1: Collect customer input ''' rentalCode = input('(B)udget, (D)aily, or (W)eekly rental?\n') if rentalCode == 'B' or rentalCode == 'D': rentalPeriod = int(input('Number of Days Rented:\n')) else: rentalPeriod = int(input('Number of Weeks Rented:\n')) daysRented = rentalPeriod #Assigning a dollar amount (double floating number) to the varying rates budget_charge = 40.00 daily_charge = 60.00 weekly_charge = 190.00 #baseCharge changes value based on the type of rental code using multiplication #Each branch of if or elif assignes a different value to...

  • Code comments explain and facilitate navigation of the code python import sys rentalcode = input("(B)udget, (D)aily,...

    Code comments explain and facilitate navigation of the code python import sys rentalcode = input("(B)udget, (D)aily, or (W)eekly rental?\n").upper() if rentalcode == 'B' or rentalcode == 'D': rentalperiod = int(input("Number of Days Rented:\n")) else: rentalperiod = int(input("Number of Weeks Rented:\n")) # Pricing budget_charge = 40.00 daily_charge = 60.00 weekly_charge = 190.00 #Second Section 2 odostart =int(input("Starting Odometer Reading:\n")) odoend =int(input("Ending Odometer Reading:\n")) totalmiles = int(odoend) - int(odostart) if rentalcode == 'B': milecharge = 0.25 * totalmiles if rentalcode == "D":...

  • I am completing a rental car project in python. I am having syntax errors returned. currently...

    I am completing a rental car project in python. I am having syntax errors returned. currently on line 47 of my code "averageDayMiles = totalMiles/daysRented" my entire code is as follows: #input variable rentalCode = input("(B)udget , (D)aily , (W)eekly rental? \n") if(rentalCode == "B"): rentalPeriod = int(input("Number of hours rented?\n")) if(rentalCode == "D"): rentalPeriod = int(input("Number of days rented?\n")) if(rentalCode == "W"): rentalPeriod = int(input("Number of weeks rented?\n")) rentalPeriod = daysRented return rentalCode , rentalPeriod budget_charge = 40.00 daily_charge...

  • Collect Customer Data - Part 1 Hint: This input code is similar to the code in...

    Collect Customer Data - Part 1 Hint: This input code is similar to the code in the previous step but use a conditional statement to test if the rentalPeriod is a daily or weekly rental then set the user input equal to rentalPeriod. Add code to PRINT the rentalCode and rentalPeriodvariables to check your work. The following data will be used as input in the first check: rentalCode = 'D' rentalPeriod = 5 Customer Data Check 1A Check It!SHOW DIFF...

  • Calculate the base charge if rentalCode == 'B': baseCharge = rentalPeriod * budgetCharge Set the base...

    Calculate the base charge if rentalCode == 'B': baseCharge = rentalPeriod * budgetCharge Set the base charge for the rental type equal to the variable baseCharge. The base charge is the rental period * the appropriate rate: For example: Finish the conditional statement by adding the conditions for other rental codes. import sys ''' Section 1: Collect customer input ''' # For holding cost of miles drive mileCharge = 0 # Reading type of rental rentalCode = input("(B)udget, (D)aily, or...

  • in Python The program will compute and display information for a company which rents vehicles to...

    in Python 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. 1. The program will repeatedly prompt the user to enter the following four items for a given customer (in the specified order): a. The customer's classification code (a character) b. The number of days the vehicle was rented (a number) c. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT