0

Car Rental will rent cars to their customer. They have the potential to rent either petrol, diesel, electric, or hybrid cars.
They have initially 40 cars in their rental pool made up of 50% petrol, 20% diesel, 10% electric and 20% hybrid.
When a car is not rented it is available to the customer to rent.
Once a car is rented the car is assigned to the customer, and removed from the rental pool.
When the car is returned by the customer it is assigned back into the rental pool.
If all 40 cars are rented out the rental function should return a message to the customer saying "Sorry nothing to rent, please try again"
All classes developed should be documented and accompanied by an associated test suite for the classes written. carDealership.py, carDealership_app.py and test_carDealership.py

3
Contributors
5
Replies
21
Views
2 Months
Discussion Span
Last Post by Fitzwilliam_1
1

We will be happy to help you if you show us what you have done so far and explain what you are having trouble with.

0

Here, such an app would not be complete without checking off or selling insurance too. There may be local taxes, fees too so it's going to be much more work than you listed to really have a finished rental portal. I mean, you wouldn't do this in a classic app but as a web app. Right?

0

Could list all car attributes . All working fine like mode, make, year , mileage. How can I do rent function to decrement from petrol totals and from total cars??? Here is :

def rentCar(self):

     class CarFleet(object):

def __init__(self):
    self.__petrolCars = 20
    self.__desielCars = 8
    self.__electricCars = 4
    self.__hybridlCars = 8
    self.__totalNumAvailable = 40 

def rentCar(self):
    while True:
        self.carType = raw_input("Please enter your car type")
        numCarsRented = raw_input("Please enter how many cars")
        try:

            numCarsRented = int(numCarsRented)
        except:
            print "Enter numeric number"
            continue
        if self.carType == "petrol":
            print "Available Petrol cars are:", self.__petrolCars
            print "remaining Petrol car is :", self.__petrolCars - numCarsRented
            print "Total cara remaining is :", self.__totalNumAvailable - numCarsRented
        elif self.carType == "diesel":
            print "Available Diesel cars are:", self.__desielCars
            print "remaining Diesel car is :", self.__desielCars - numCarsRented
            print "Total cara remaining is :", self.__totalNumAvailable - numCarsRented
        if "Q" == raw_input("Q to quit / enter to continue "):
            break

Edited by Reverend Jim: Corrected code formatting

0

When Loop is repeated , it is not decrementing from the last value in numCarsRented

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.