Question: IMPORTANT: This is an individual assignment. You may not work with a partner on this assignment. You should not use static/global variables or methods anywhere
IMPORTANT: This is an individual assignment. You may not work with a partner on this assignment.
You should not use static/global variables or methods anywhere in this assignment.
Each class should be created in its own file.
-------------------------
Goal:
To use more advanced OO techniques to represent complex class relationships describing different types of buildings.
Deliverables:
NetBeans (exported) ZIP file named BuildingProject_YourLastName.zip
A screen capture of your UML Class diagram.
-------------------------
Requirements:
Step 1: Create a new Java project named BuildingProject
---------
Step 2: Add a Building class in that project. It should be an abstract class. Your Building class must be properly encapsulated and include the following attributes:
Purchase Cost
Building Color
Owner Name
Additionally, your Building class should contain an instance of an Address class, which will be described below.
In addition to a constructor that allows you to set all of these values, it should include a getInfo() method and an abstract calculateVolume() method.
---------
Step 3: Create an Address class. It should contain the following attributes:
Street Number and Name
City
State
Zip
It should have a constructor that sets all values, and a getInfo() method that returns all values.
---------
Step 4: Add a CircularSilo class to your project. Your CircularSilo must be a subclass of your Building class. In addition to the attributes that it inherits from Building, CircularSilo should add the following attributes:
Radius
Height
It should include a getInfo() method and a calculateVolume() method that override the versions of these methods from your parent class. You may use the following formula for volume:
volume=radius2height
---------
Step 5: Add a RectangularRanch class to your project. Your RectangularRanch must be a subclass of your Building class. In addition to the attributes that it inherits from Building, RectangularRanch should add the following attributes:
Length
Width
Height
It should include a getInfo() method and a calculateVolume() method that override the versions of these methods from your parent class. You may use the following formula for volume:
volume = length * width * height
Important: In steps 3 and 4, your getInfo() methods must use the super keyword to leverage the getInfo() method of its superclass (Building). Remember DRY - Dont Repeat Yourself! You should not unnecessarily duplicate any code between getInfo() in your subclass and superclass!
---------
Step 6: Create a UML Class Diagram for your Building, Address, CircularSilo, and RectangularRanch classes. You must follow the 3 box approach used in class, represent "is-a" relationships with vertical lines, "has-a" relationships with horizontal lines, and label your relationships.
You may use any tool you like (including paper and pen!), but you must upload an image of your diagram. No credit will be given for VISIO files or URLs to websites.
---------
Step 7 (Optional: Up to +3 bonus points): Create JUnit tests for the calculateVolume method of your CircularSilo class. Using the pattern shown in class, create tests to ensure correct calculations when radius = 0 and height is positive, when height = 0 and radius is positive, when both values are positive, and when both values are zero.
---------
Step 8: In your main method, create instances (1 each) of your CircularSilo and RectangularRanch classes, along with any necessary instances of your Address class. Populate all values using the class constructors. There is no need to use Scanner -- you may hard-code these values in your main() method. Use the getInfo()methods of CircularSilo and RectangularRanch to retrieve all info (including Address details), and display this info.
---------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
