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
LAST RUN on 5/8/2019, 9:35:15 PM
Check 1 failed
Output:
File "rental_car-customer-data-1.py", line 21 if(rentalCode =="B"): ^ SyntaxError: invalid syntax
Expected:
(B)udget, (D)aily, or (W)eekly rental? Number of Days Rented: B 3
The following data will be used as input in the second check:
rentalCode = 'W' rentalPeriod = 1
Prompt: "(B)udget, (D)aily, or (W)eekly rental?\n"
Variable: rentalCode = ?
| Code | Category | Rate |
|---|---|---|
| B | budget | budget_charge = 40.00 |
| D | daily | daily_charge = 60.00 |
| W | weekly | weekly_charge = 190.00 |
Set the user input equal to rentalCode.
rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
OR
Prompt: "Number of Weeks Rented:\n"
Variable: rentalPeriod = ?
import sys
'''
Section 1: Collect customer input
'''
##Collect Customer Data - Part 1
##1) Request Rental code:
#Prompt --> "(B)udget, (D)aily, or (W)eekly rental?"
#rentalCode = ?
#2) Request time period the car was rented.
#Prompt --> "Number of Days Rented:"
#rentalPeriod = ?
# OR
#Prompt --> "Number of Weeks Rented:"
#rentalPeriod = ?
#CUSTOMER DATA CHECK 1
#ADD CODE HERE TO PRINT:
#rentalCode
#rentalPeriod
#Calculation Part 1
##Set the base charge for the rental type as the variable
baseCharge.
#The base charge is the rental period * the appropriate rate:
If you have any doubts, please give me comment...

Code:
import sys
#ask user for input of type of rental
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"))
budgetCharge = 40.00
dailyCharge = 60.00
weeklyCharge = 190.00
#calulate charges depending on input from above
if rentalCode == "B":
baseCharge= rentalPeriod * 40.00
elif rentalCode == "D":
baseCharge= rentalPeriod * 60.00
else:
baseCharge= rentalPeriod * 190.00
Collect Customer Data - Part 1 Hint: This input code is similar to the code in...
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...
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 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...
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":...
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)...
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...
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...
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...
Propose: In this lab, you will complete a Python program with one partner. This lab will help you with the practice modularizing a Python program. Instructions (Ask for guidance if necessary): To speed up the process, follow these steps. Download the ###_###lastnamelab4.py onto your desktop (use your class codes for ### and your last name) Launch Pyscripter and open the .py file from within Pyscripter. The code is already included in a form without any functions. Look it over carefully....
Create another program that will prompt a user for input file. The user will choose from 4 choices: 1. Display all positive balance accounts. 2. Display all negative balance accounts. 3. Display all zero balance accounts. 4. End program. C PROGRAMMING my code so far #include<stdlib.h> #include<stdio.h> int main(void) { int request; int account; FILE *rptr; char name[20]; double balance; FILE *wptr; int accountNumber; if((wptr = fopen("clients.dat","w")) == NULL) { puts("File could not be opened"); } else {...
This Python module will be menu driven and use conditions to check user input in order to determine which operation to perform based on the user’s menu selection. The output should look like the attached example output. The menu will have the following selections (NOTE: all menu selections by the user should not be case sensitive) : 1. ‘CC’ – Character Count a. This operation will prompt the user for a string b. The number if characters will be counted...