Answered step by step
Verified Expert Solution
Question
1 Approved Answer
First, create a new java file named House.java. At the beginning of this file, copy the program header from line 1-11 in file CorrectSequence.java to
First, create a new java file named House.java. At the beginning of this file, copy the program header from line 1-11 in file "CorrectSequence.java" to House.java, then change line 1, 3, 4, and line 7-10, to make these lines suitable for file House.java. Then right after the program header, please write down the definition line for public class House. Then in the body of this class House, do the following 1. define two private data member: total price of double type (for example, a value of 168000 indicates that this house is worth 168000 dollars), and total square feet of double type (for example, a value of 2398 indicates that this house has 2398 square feet in total) 2. define two public constructors, the first one is the default constructor with no parameter, and the second 3. for every data member, provide a public getter and a public setter, so there are two getters and two setters 4. provide a public method named calcPricePerSaf.. This method returns the average price per square foot of one has two formal parameters to initialize the two private data members of this class in total. Refer to the BookOrder.java for examples of getter and setter methods the house by dividing the total price by the total square feet. The return type of this method is double. This method does NOT need any formal parameter, because as a public member method, this method can directly access the private data members of the same class 5. provide a public method named calcPropertyTax. This method returns a double type value, which is the property tax of this house. This method needs only ONE formal parameter, which is a double type variable named taxPercentage. The property tax of the house is calculated by multiplying the total price of the house (a private data member of the class) with the tax percentage (the formal parameter of this method) For example, if the tax percentage is 1.25 percent for a house of 160000 dollars, then the property tax is 160000 * 1.25 * 0.01 = 2000 dollars. Notice that the 0.01 in the above formula is to convert the 1.25 percent to the real value. Attention: taxPercentage is a formal parameter of this method, and it is NOT a data member of the House class, therefore, do not make the mistake of setting taxPercentage as a private data member of the House class, and if you do that, you are in the wrong track
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started