*JAVA* taxRate is a whole number; and is 8 The Owner constructors do not set the
ID: 3734238 • Letter: #
Question
*JAVA*
taxRate is a whole number; and is 8
The Owner constructors do not set the propertyList.
There is no setPropertyList.
Owner
-name:String
-propertyList:ArrayList<Property>
-count:int
+addProperty(Property p):void
+getPropertyList():ArrayList<Property>
Address
-street:String
-city:String
-state:String
-zip:int
Property
-address:Address
-marketValue:double
+calculateTax(double taxRate):double
CommercialProperty
-propertyType:String
-squareFeet:int
+calculateTax(double taxRate):double
ResidentialProperty
-platNumber:int
+calculateTax(double taxRate):double
Write the classes according to our coding standards.
You cannot modify the UML when coding.
PropertyTest program will declare an array list of Owners. You will use the following data
in a 2-D string array to create the owners and add property to their propertyList. You must use
loops to walk through the array to create them. There is only one 2D array. There are no 1D
arrays.
Jones,Commercial,123 Mitchell,Arlington,Texas,76019,120000, sales, 21000
Smith,Residential,61 Bose Lane,Dallas,Texas,75002,310000, 65656
Jones,Commercial,2500 West Seventh St, Fort Worth,Texas,76015,575000,food, 15750
Smith,Commercial,1225 Green Rd,Euless,Texas,76000,215500,entertainment,9500
Jones,Residential,5214 Linda Lane,Houston,Texas,77700,195775, 98541
calculateCharge is marketValue * taxRate. CommercialProperty has an additional charge. If the property type is ‘sales’ and the square feet is over 10000, add $500.00.
ResidentialProperty has an additional charge of $.05 for each $1000 of market value.
Then, loop through the Owners array and calculate the property taxes and print to a dialog box.
Address.java, Owner.java, Property.java, CommercialProperty,
ResidentialProperty, and PropertyTest.java
Explanation / Answer
import java.util.ArraysList;
class Owner {
private String name;
ArrayList < Property[] > propertyList = new ArrayList < Property[] > ();
private int count;
public static getName() {
System.out.println(this.name," ");
}
public static setName(String name) {
this.name=name;
}
public static getCount() {
System.out.println(this.count," ");
}
public static setCount(int count) {
this.count=count;
}
public Owner(String name, int count) {
this.name=name;
this.count=count;
}
public addProperty(Property p) {
this.propertyList.add(p);
}
public Property getPropertyList() {
int i;
for (i=0; i<this.propertyList.size; i++) {
System.out.println(this.propertyList.get(i)," ");
}
}
}
class Address {
private String street;
private String city;
private String state;
private int zip;
public Address ( String street, String city, String state, int zip) {
this.street=street;
this.city=city;
this.state=state;
this.zip=zip;
}
public static getStreet() {
System.out.println(this.street," ");
}
public static setStreet(String street) {
this.street=street;
}
public static getCity() {
System.out.println(this.city," ");
}
public static setCity(String city) {
this.city=city;
}
public static getState() {
System.out.println(this.state," ");
}
public static setState(String state) {
this.state=state;
}
public static getZip() {
System.out.println(this.zip," ");
}
public static setZip(int zip) {
this.zip=zip;
}
}
class Property {
private Address address;
private double marketValue;
public Property(Address address, double marketValue) {
this.address=address;
this.marketValue=marketValue;
}
public static getAddress() {
System.out.println(this.address," ");
}
public static setAddress(Address address) {
this.address=address;
}
public static getMarketValue() {
System.out.println(this.marketValue," ");
}
public static setMarketValue(int marketValue) {
this.marketValue=marketValue;
}
public double calculateTax(double taxRate); {
return marketValue*8;
}
}
class CommercialProperty {
private String propertyType;
private int squareFeet;
public CommercialProperty(String propertyType, int squareFeet) {
this.propertyType=propertyType;
this.squareFeet=squareFeet;
}
public static getSquareFeet() {
System.out.println(this.squareFeet," ");
}
public static setSquareFeet(int squareFeet) {
this.squareFeet=squareFeet;
}
public static getPropertyType() {
System.out.println(this.propertyType," ");
}
public static setPropertyType(int propertyType) {
this.propertyType=propertyType;
}
public double calculateTax(double taxRate); {
if (this.propertyType="sales" and this.squareFeet>10000) {
return this.marketValue*8+500;
}
return this.marketValue*8;
}
class ResidentialProperty {
private int platNumber;
public ResidentialProperty( int platNumber) {
this.platNumber=platNumber;
}
public static getPlatNumber() {
System.out.println(this.platNumber," ");
}
public static setPlatNumber(int platNumber) {
this.platNumber=platNumber;
}
public double calculateTax(double taxRate); {
return this.marketValue*8+(this.marketValue/1000)*0.05;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.