Question
I need a python program to do the following. The program cannot be written with functions and must use loops. A car rental company has
I need a python program to do the following. The program cannot be written with functions and must use loops.
A car rental company has three types of cars for customers to choose.
Compact: $30 per day for first 3 days. $26 per day for any additional days.
Mid size: $37 per day for first 3 days. $32 per day for any additional days.
Full size: $45 per day for first 3 days. $38 per day for any additional days.
Write a Python program to do the following.
(a) [4 points] Ask user to choose car type. Enter C for compact, M for mid size or F for full size. User may enter uppercase or lowercase letter. Both C and c should be accepted for compact. Both M and m should be accepted for mid size. Both F and f should be accepted for full size. If an invalid car type is entered, display "Invalid car type. Program ended." and end the program. Otherwise, proceed to part (b).
(b) [4 points] Ask user to enter number of days. Since user is expected to enter a whole number, it is safe to convert it to an integer. If 0 or a negative number is entered, display "Invalid number of days. Program ended" and end the program. Otherwise, proceed to part (c).
(c) [12 points] Calculate and display rental fee.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started