Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Intro to Java Assingment-2

cato3
cato3 


PLEASE INCLUDE SCREENSHOT OF WORKING PROGRAM OR I WILL NOT TAKE IT THANK YOU 1. Write a class called House to hold details of the location (street number, street name, town) and the year of construction and the property tax. Write the appropriate contructor, selector and mutator methods. Also write a toString method to return the details of the house. 2. Write a subclass Home with additional instance fields for the name of the occupying family and the date they moved in. You should use the OurDate class we wrote in the class. Note the following: There should be two overloaded constructor methods: public Home (int house, String street, String town, String family, OurDate movedIn) and public Home (int house, String street, String town, int yearConstructed, int propertyTax, String family, OurDate movedIn) These should make use of the super keyword where appropriate. There should be the usual methods to set and extract the values of the new instance fields: setFamily getFamily setDateMovedIn getDateMovedIn There should be a toString method that calls the toString method provided by the House class to return the details of the house and then return the text "has been occupied by FAMILY since DATE", with suitable values inserted. You should make the three classes (House, Home, OurDate) part of the package insy.java.hw6. 3. Write a simple driver application that prompts the user to enter the appropriate information about a home, creates an instance of the Home class, and then prints out the details of that home. Make sure to use the appropriate import statement(s) to import the above classes. Deliverables: You should submit the four source code files (House.java, Home.java, OurDate.java, HomeDriver.java). Attachments Tags Clarifications

Answers

All files

pishi
pishi 



Put House,Home, and OurDate in one folder and run this command( javac -d . *.java ). Then you can run your HomeDriver file. Attachments
Screenshots
Purchase Answer

Solution

mariobeka
mariobeka 



Below you'll find the solution of your assignment. Heavily commented for better understanding. Attachments
src.zip (4 K) Download


Preview
} /** * Sets the moved in date. * * @param movedIn the moved in date. */ public void setMovedIn(OurDate movedIn) { this.movedIn = movedIn; } /** * Gets the family name whose occupying the home. * * @return the family name whose occupying the home */ public String getFamily()

Preview
user for the street name. System.out.print("Please provide the street name: "); String streetName = in.nextLine(); // Prompt the user for the town name. System.out.print("Please provide the town name: "); String town = in.nextLine(); // Prompt the user for the family name. System.out.print("Please provide the family name: "); String familyName =

Preview
the construction year of the house. */ public int getConstructionYear() { return constructionYear; } /** * Sets the construction year of the house. * * @param constructionYear the construction year of the house. */ public void setConstructionYear(int constructionYear) { this.constructionYear = constructionYear; } /** * Gets the property tax of

Preview
) ) month = m; } public void setDay( int d ) { if ( ( d >= 0 ) && ( d <= 31 ) ) day = d; } public void setYear( int y ) { if ( y >= 0 ) year = y; } public String

Screen Shot 2015-07-26 at 10.26.44 PM.png (101 K) Download Preview

Screenshots
Screenshot
Purchase Answer