Question: JAVA Create a home inventory class that will be used by a national builder to maintain inventory of available houses in the country. The following
JAVA
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 square_feet
- private string address
- private string city
- private string state
- private int zip_code
- private string Model_name
- private string sale_status (sold, available, or under contract)
Your program should have appropriate methods such as:
- constructor
- add a new home
- remove a home
- update home attributes.
All methods should include try..catch constructs. Except as noted, all methods should return a success or failure message (failure message defined in "catch").
1. Create an additional class to call your home class (e.g., Main or HomeInventory). Include a try..catch construct and print it to the console.
2. Call home class with parameterized constructor (e.g., "square_feet, address, city, state, zip_code, Model_name, sale_status").
- Then, call the method to list the values. Loop through the array and print to the screen
3. Call the remove home method to clear the variables:
- Print the return value.
4. Add a new home.
- Print the return value.
- Call the list method and print the new home information to the screen.
5. Update the home (change the sale status).
- Print the return value.
- Call the listing method and print the information to the screen.
6. Display a message asking if the user wants to print the information to a file (Y or N).
- Use a scanner to capture the response. If "Y", print the file to a predefined location (e.g., C:\Temp\Home.txt). Note: you may want to create a method to print the information in the main class.
- If "N", indicate that a file will not be printed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
