I want to design a class named houses
that holds the street address, asking price, number of bedrooms and number of bathrooms in the house. I would also like methods included to get and set values for each data field.
First time working with classes. I got the class setup and I'm able to print the classes but I'm not sure how or which methods to use.
class houses:
def __init__(self, Adress, Askingprice, NumOfBedrooms, NumofBathroom):
self.Adress = Adress
self.Askingprice = Askingprice
self.NumOfBedrooms = NumOfBedrooms
self.NumofBathroom = NumofBathroom
def HouseDetails(self):
return "The house is at {} with a price of {} and has {} Bedroom/s and {} bathroom/s" \
.format(self.Adress, self.Askingprice, self.NumOfBedrooms, self.NumofBathroom)
house1 = houses("Almonaster_Avenue87", "R 500k", 1, 1)
house2 = houses("Audubon_Place33", "R 900k", 3, 3)
house3 = houses("Baronne_Street78", "R800k", 3, 2)
house4 = houses("Basin_Street55", "R700k", 2, 1)
house5 = houses("Bayou_Road11", "R 900", 4, 2)
house6 = houses("Bienville_Street78", "R700k", 2, 2)
house7 = houses("Bourbon_Street45", "R 800k", 4, 1)
house8 = houses("Broad_Street56", "R 900k", 5, 3)
print("\n",house1.HouseDetails())
Please Note
The "R" at asking price is my currency.