Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION1 A car rental company has three types of cars for customers to choose. Compact: $30 per day for first 3 days. $26 per day

image text in transcribed

image text in transcribed

QUESTION1 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. The following is an example: Enter C for compact, M for mid size, F for full size: X Invalid car type. Program ended The following is another example: Enter C for compact, M for mid size, F for full size: m How many days? 0 Invalid number of days. Program ended. The following is another example: Enter C for compact, M for mid size, F for full size: C How many days? 6 Rental fee: 142

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

What is a point estimator of a population parameter?

Answered: 1 week ago