Situation: Used Cars of PEI is looking for a program that will allow its represe
ID: 3573056 • Letter: S
Question
Situation: Used Cars of PEI is looking for a program that will allow its representatives to calculate the current value of a vehicle based on certain criteria. Your program must ask the representative for each data element, once it has this information it will calculate the vehicle current value, after which it must ask you if you would like to “Enter another vehicles information?” in order to start the process again without having to restart the program. Input data elements: Vehicle Price: ___________ Mileage on Vehicle: ________ Transmission (A-automatic / M-manual): ____ Sunroof (Y/N): ____ Rules that govern the use vehicle value calculations: Mileage: 0 to 59,999 à Lose 30% of original price 60,000 to 99,999 à Lose 35% of original price 100,000 to 199,999 à Lose 40% of original price 200,000 to over à Lose 50% of original price Transmission: Automatic ~ add 5% of original price back on Manual ~ remove 5% of original price Sunroof: Yes ~ add 10% of original price back on Output the result as following: Your vehicle is now valued at: $ 999.99 (**remember to control the precision displayed**)
Explanation / Answer
choice = 'y'
while choice == 'y':
price = input('Vehicle Price: ')
mileage = input('Mileage on Vehicle: ')
transmission = raw_input('Transmission (A-automatic / M-manual): ')
sunroof = raw_input('Sunroof (Y/N): ')
if mileage<=59999:
current_value = 0.7*price
elif 60000<=mileage<=99999:
current_value = 0.65*price
elif 100000<=mileage<=199000:
current_value = 0.6*price
else:
current_value = 0.5*price
if transmission.upper()=='A':
current_value += 0.05*price
else:
current_value -= 0.05*price
if sunroof.upper()=='Y':
current_value += 0.1*price
print "Your vehicle is now valued at:", round(current_value, 2)
choice = raw_input('Enter another vehicles information? (y for yes): ')