A Real Estate Agency needs Management System that records the details about their offers: houses and apartmentsIn this project, you will be using object-oriented programming concepts and design in total four classes:In this assignment 6-7, you will implement two classes named Residence and AddressIn the next assignment 8-9, you will design two other classes: House, and Apartment. The following di
...[Show More]
A Real Estate Agency needs Management System that records the details about their offers: houses and apartments
In this project, you will be using object-oriented programming concepts and design in total four classes:
In this assignment 6-7, you will implement two classes named Residence and Address
In the next assignment 8-9, you will design two other classes: House, and Apartment.
The following diagram shows the relationships between these classes you are required to implement.
you will implement Address and Residence classes. The Residence class is the parent class of apartment and House classes.
Consider the following UML class diagram:
submit a new java project.
Question 1 [10 marks]:
A. Implementation details of Address class:
Add and implement a class named Address according to specifications in the UML class diagram.
- Data fields: street, city, province and zipCode.
- Constructors:
A no-arg constructor that creates a default Address.
A constructor that creates an address with the specified street, city, state, and zipCode
- Getters and setters for all the class fields.
- toString() to print out all available information about the current object
B. A test program for the Address class
To demonstrates the Address class, in main method a program that:
1. Prompts the user to enter the street name
2. Prompts the user to enter city name
3. Prompts the user to enter the province name
4. Prompts the user to enter the zip code
5. Creates an instance called testAddress of type Address with the entered data
6. Displays this information using toString().
Example of data:
Street: 265 Yorkland Blvd.
City: Toronto
State: Ontario
zipCode: M2J 1S5
Question 2 [10 marks]:
A. Implementation details of Residence class:
Add and implement a class named Residence according the instruction in the UML diagram
- Data fields: bedrooms, bathrooms, price, squareFeet, yearBuilt and address.
- Constructors:
A no-arg constructor that creates a default Residence.
A constructor that creates a Residence with the specified bedrooms, bathrooms, price, squareFeet, yearBuilt and address.
- Getters and setters for all the class fields.
- calculateCommission() that returns the commission amount. The commission rate is set up at 2%.
- toString() that returns the information about the current object( bedrooms, bathrooms, etc.).
B. A test program for the Residence class
In main method, you already created an instance of Address class called testAddress and prompted the user to enter the address details.
1. Now prompt the user to enter the numbers of bedrooms and bathrooms, price, square Feet and year built.
2. an instance of the residence class with the entered data (including the address data).
3. Display the information about the residence using toString().
[Show Less]