Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Raj39120/95074f91bdb37e50ef2dbd6ed3ce3cfa to your computer and use it in GitHub Desktop.
Save Raj39120/95074f91bdb37e50ef2dbd6ed3ce3cfa to your computer and use it in GitHub Desktop.
class Cost:
def __init__(self, time, sea, pool, umbrella, table, total_cost):
self.time = time
self.sea = sea
self.pool = pool
self.umbrella = umbrella
self.table = table
self.total_cost = total_cost
b = input("Enter the amount of sunbeds by the sea you want to rent (40 dollars each per hour): ")
c = input("Enter the amount of sunbeds by the swimming pool you want to rent (20 dollars each per hour): ")
d = input("Enter the amount of umbrellas you want to rent (35 dollars each per hour): ")
e = input("Enter the amount of tables you want to reserve (20 dollars each per hour): ")
a = int(input("Enter the time in hours you want to rent the equipment for (less than or equal to five hours): "))
while a > 5:
print("The amount that you entered is more than five hours, please enter a valid duration to rent equipment.")
a = int(input("Enter the time in hours you want to rent the equipment for (less than or equal to five hours): "))
f = a*(b*40 + c*20 + d*35 + e*20)
Equipment_Charges = Cost(a, b, c, d, e, f)
print("Length of hire " + str(Equipment_Charges.time) + " hours.")
print(str(Equipment_Charges.sea) + " sunbeds next to sea " + str(b*40) + " dollars per hour.")
print(str(Equipment_Charges.pool) + " sunbeds next to swimming pool " + str(c*20) + " dollars per hour.")
print(str(Equipment_Charges.umbrella) + " umbrellas " + str(d*35) + " dollars per hour.")
print(str(Equipment_Charges.table) + " tables " + str(e*20) + " dollars per hour.")
print("Total to pay " + str(f) + " dollars.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment