Untitled
unknown
plain_text
a year ago
1.5 kB
3
Indexable
Never
public class Land{ //Data Members private int id; private String name; private char houseType; private double area; //Method Members //Dafault Constructor public Land(){ id = 0; name = ""; houseType = ' '; area = 0; } //Normal Constructor public Land(int idx, String nme, char hty, double are){ id = idx; name = nme; houseType = hty; area = are; } //Copy Constructor public Land(Land lnd){ id = lnd.id; name = lnd.name; houseType = lnd.houseType; area = lnd.area; } //Setter public void setId(int idx){ id = idx; } public void setName(String nme){ name = nme; } public void setHouseType(char hty){ houseType = hty; } public void setArea(double are){ area = are; } //Getter public int getId(){ return id; } public String getName(){ return name; } public char getHouseType(){ return houseType; } public double getArea(){ return area; } //Processor public double calcTax(){ double rate = 0; if(houseType == 'T' || houseType == 't') rate = 10.00; else if(houseType == 'S' || houseType == 's') rate = 15.00; if(houseType == 'B' || houseType == 'b') rate = 20.00; if(houseType == 'C' || houseType == 'c') rate = 30.00; return (area * rate); } //Printer public String toString(){ return "\n\nId: "+id+ "\nOwner Name: "+name+ "\nHouse Type: "+houseType+ "\nArea: "+area; } }