Final PYTHON program:
Create a home inventory class that will be used by a National
Builder to maintain inventory of available houses in the country.
The following attributes should be present in your home
class:
-private int squarefeet
-private string address
-private string city
-private string state
-private int zipcode
-private string Modelname
-private string salestatus (sold, available, under contract)
Your program should have appropriate methods such as:
-constructor
-add a new home
-remove a home
-update home attributes
At the end of your program, be sure that it allows the
user to output all home inventory to a text file.
Be sure that your final program includes your source code
and screenshots of the application, executing the application, and
the results.
Thanks for posting the question, Here are the two classes in python you will be needing. Home.py is a class that encapsulates all the instance variables and function a home can have. While HomeInventory.py encompases a list of Home object and operations on the individual Home.
Let me know for any questions and doubts, i'll be happy to assist you
_________________________________________________________________________________________________
class Home(): homes=[] def __init__(self,sq_ft,address,city,state,zip,model,status): self._square_feet=sq_ft self._address=address self._city=city self._state=state self._zipcode=zip self._model=model self._status=status def get_home_size(self): return self._square_feet def get_home_address(self): return self._address def get_home_city(self): return self._city def get_home_state(self): return self._state def get_home_zipcode(self): return self._zipcode def get_home_model(self): return self._model def get_home_status(self): return self._status def set_home_size(self,sq_ft): self._square_feet=sq_ft def set_home_address(self,address): self._address=address def set_home_city(self,city): self._city=city def set_home_state(self,state): self._state=state def set_home_zipcode(self,zip): self._zipcode=zip def set_home_model(self,model): self._model=model def set_home_status(self,status): self._status=status def __str__(self): return str(self._square_feet)+","+str(self._address)+","+str(self._city)+"," +str(self._state)+","+str(self._zipcode)+","+str(self._model)+","+str(self._status)
_________________________________________________________________________________________________
class HomeInventory(): def __init__(self): self.home_list=[] def add_home(self,home): self.home_list.append(home) def remove_home(self,sq_ft,address,city,state,zip,model,status): home_to_be_deleted=None for home in self.home_list: if home.get_home_size()==sq_ft and home.get_home_address()==address and home.get_home_city()==city and home.get_home_state()==state and home.get_home_zipcode()==zip and home.get_home_model()==model and home.get_home_status()==status: home_to_be_deleted=home break self.home_list.pop(home_to_be_deleted) def update_home_attribute(self,home,attribute_name,attribute_value): if not home ==None: if attribute_name=='squarefeet': home.set_home_size(attribute_value) elif attribute_name=='address': home.set_home_address(attribute_value) elif attribute_name=='city': home.set_home_city(attribute_value) elif attribute_name=='state': home.set_home_state(attribute_value) elif attribute_name=='zip': home.set_home_zipcode(attribute_value) elif attribute_name=='model': home.set_home_model(attribute_value) elif attribute_name=='status': home.set_home_status(attribute_value) def export_to_file(self,file_path): try: with open(file_path,'w+') as write_file: for home in self.home_list: write_file.write(home) write_file.write(' ') except: print('Error occurred while writing to file!')
_________________________________________________________________________________________________
thank you !
Final PYTHON program: Create a home inventory class that will be used by a National Builder...
I need this in java please Create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string make private string model private string color private int year private int mileage. Your program should have appropriate methods such as: default constructor parameterized constructor add a new vehicle method list vehicle information (return string array) remove a vehicle method update vehicle attributes method. All methods...
Create the Python code for a program adhering to the following specifications. Write an Employee class that keeps data attributes for the following pieces of information: - Employee Name (a string) - Employee Number (a string) Make sure to create all the accessor, mutator, and __str__ methods for the object. Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: - Shift number (an integer,...
Respond to both of the following scenarios for Python programming. Scenario #1: A car dealership has hired your software development firm to create a new car inventory program. You first need to develop a class that represents the inventory of the dealership. What components and attributes will need to be included in your automobile class? Why? Scenario #2: A national builder has hired your software development firm to create a home inventory program. You first need to develop a class...
Help with StringAnalysis Write a WidgetViewer application. Create a class StringAnalysis. This class has an event handler inner that extends WidgetViewerActionEvent it has instance variables StringSet sSet JTextField inputStr JLabel numStr JLabel numChar In the constructor, create a WidgetViewer object create sSet create a local variable JLabel prompt initialized to "Enter a String" create inputStr with some number of columns create a local variable JButton pushMe initialized to "Push to include String" create numStr initialized to "Number of Strings: 0"...
Create a class House with the private fields: numberOfUnits of the type int, yearBuilt of the type int, assessedPrice of the type double. A constructor for this class should have three arguments for initializing these fields. Add accessors and mutators for all fields except a mutator for yearBuilt, and the method toString. Create a class StreetHouse which extends House and has additional fields: streetNumber of the type int, homeowner of the type String, and two neighbors: leftNeighbor and rightNeighbor, both...
9.12 Ch 9 Program: The Evil Register Python 3.7"The ItemToPurchase classIf you haven't done so already, make sure to complete zyLab 9.11 before this one. Otherwise, you will have to implement the ItemToPurchase class from scratch and this zyLab won't make much sense".ItemToPurchase class from zyLab 9.11 refers to:(1) Build the ItemToPurchase class with the following specifications:Attributes (3 pts)item_name (string)item_price (int)item_quantity (int)Default constructor (1 pt)Initializes item's name = "none", item's price = 0, item's quantity = 0Methodprint_item_cost()
Create a Python file (book.py) that has a class named Book. Book class has four attributes, title (string), author(string), isbn(string), and year(int). Title - the name of the book. Author - the name of the persons who wrote the book. ISBN - is a unique 13 digit commercial book identifier. Year - the year the title was printed. Your class should have the following methods: (1) __init__(self, title, author, isbn, year): This method called when an object (book) is created...
Create a Python file (book.py) that has a class named Book. Book class has four attributes, title (string), author(string), isbn(string), and year(int). Title - the name of the book. Author - the name of the persons who wrote the book. ISBN - is a unique 13 digit commercial book identifier. Year - the year the title was printed. Your class should have the following methods: (1) __init__(self, title, author, isbn, year): This method called when an object (book) is created...
Write a Python program that creates a class which represents a candidate in an election. The class must have the candidates first and last name, as well as the number of votes received as attributes. The class must also have a method that allows the user to set and get these attributes. Create a separate test module where instances of the class are created, and the methods are tested. Create instances of the class to represent 5 candidates in the...
using python 3: Program 14: Class with Private Attribute Collection of Objects: modRoom.py Step 1: Create a class called Room as indicated by the UML shown below: Student -length: integer width: integer -height integer -roomNum: integer -roomType: String -room Capacity: integer <<constructor Room (tmpRoomNum:integer tmpRoomType: String, tmpCapacity:integer tmplength: integer, tmpWidth: integer, tmpHeight: integer) +get Length(): Integer +getWidth(): Integer +getHeight(): Integer +get RoomNum(): Integer +getRoom Type(): String +getRoomCapacity(): Integer tRoomType(): String +set +setRoomCapacity(): Integer +calcArea(): Integer +calcSurfaceArea(): nteger +str( String should...