Class Description: Your need to create an instantiable class that represents a parcel of raw land that can be sold by a real estate company. This class should be named Land. It will contain three fields: a string named location and a width and length, measured in feet, each of which can accept numbers with decimal points. You may assume that every parcel of land is rectangular and that 'width' describes the size of the property along the road and 'length' is how far back it goes from the road. The class needs one constructor that sets the values all the fields. The class needs the following public methods: • Getters and setters for all fields. • A method called getArea that calculates and returns the area of the parcel of land in square feet. (Area is calculated as length x width.) • Standard methods: toString, equals, and hashCode where equals and hashCode define two equivalent parcels of land as each having the same length and each having the same width. • Implementation of the Comparable interface, comparing area.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
JAVA CODE
Class Description: Your need to create an instantiable class that represents a parcel of raw land that can be sold by a real estate company. This class should be named Land. It will contain three fields: a string named location and a width and length, measured in feet, each of which can accept numbers with decimal points. You may assume that every parcel of land is rectangular and that 'width' describes the size of the property along the road and 'length' is how far back it goes from the road. The class needs one constructor that sets the values all the fields. The class needs the following public methods:
• Getters and setters for all fields.
• A method called getArea that calculates and returns the area of the parcel of land in square feet. (Area is calculated as length x width.)
• Standard methods: toString, equals, and hashCode where equals and hashCode define two equivalent parcels of land as each having the same length and each having the same width.
• Implementation of the Comparable interface, comparing area.
Create a new NetBeans project and create the Land class with all the fields, constructors, and methods listed. Then create a JUnit test file for this class. It is your job to determine what makes sense to test and what values to use in order to thoroughly test the class’s methods.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 7 images