Created
May 2, 2020 22:56
-
-
Save Raj39120/806a6c269a0a884523a878d73f3a9dc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cost: | |
time = 0 | |
sea = 0 | |
pool = 0 | |
umbrella = 0 | |
table = 0 | |
cost = 0 | |
def __init__(self): | |
pass | |
def user_input(self): | |
self.time = int(input("Enter the time you want to rent the equipment for (less than or equal to five hours): ")) | |
while self.time > 5: | |
print("The hire time must be less than or equal to five hours.") | |
self.time = int(input("Enter the time you want to rent the equipment for in hours over here: ")) | |
self.sea = int(input("Enter the amount of sunbeds by the sea you want to rent (40 dollars each per hour): ")) | |
self.pool = int(input("Enter the amount of sunbeds by the pool you want (20 dollars each per hour): ")) | |
self.umbrella = int(input("Enter the amount of umbrellas you want to rent (35 dollars each per hour): ")) | |
self.table = int(input("Enter the amount of tables you want to reserve (20 dollars each per hour): ")) | |
self.cost = self.time * (self.sea * 40 + self.pool * 20 + self.umbrella * 35 + self.table * 20) | |
def equipment(self): | |
print("Length of hire " + str(self.time) + " hours.") | |
print(str(self.sea) + " sunbeds next to sea " + str(self.sea * 40) + " dollars per hour.") | |
print(str(self.pool) + " sunbeds next to swimming pool " + str(self.pool * 20) + " dollars per hour.") | |
print(str(self.umbrella) + " umbrellas " + str(self.umbrella * 35) + " dollars per hour.") | |
print(str(self.table) + " tables " + str(self.table * 20) + " dollars per hour.") | |
print("Total to pay " + str(self.cost) + " dollars.") | |
equipment_charges = Cost() | |
equipment_charges.user_input() | |
equipment_charges.equipment() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment