class Lease{ private String name; private int aptNumber; private double rent; private int term; private static final int FEE = 10; public Lease(){ name = "XXX"; aptNumber = 0; rent = 1000; term = 12; } public void setName(String tenant) { name = tenant; } public void setAptNumber(int apt){ aptNumber = apt; } public void setRent(double monthRent) { rent = monthRent; } public void setTerm(int t){ term = t; } public String getName(){ return name; } public int getAptNumber(){ return aptNumber; } public double getRent(){ return rent; } public int getTerm(){ return term; } public void addPetFee(){ rent = rent + FEE; } } Create a class named TestLease as instructed below: Instantiate four Lease objects in the main()method. Change the aptNumber value for the first object to 20 Change the rent value for the second object to 5000 Change the term value for the forth object to 6 Display the instance values for each of the instantiated objects
class Lease{
private String name;
private int aptNumber;
private double rent;
private int term;
private static final int FEE = 10;
public Lease(){
name = "XXX";
aptNumber = 0;
rent = 1000;
term = 12;
}
public void setName(String tenant) {
name = tenant;
}
public void setAptNumber(int apt){
aptNumber = apt;
}
public void setRent(double monthRent) {
rent = monthRent;
}
public void setTerm(int t){
term = t;
}
public String getName(){
return name;
}
public int getAptNumber(){
return aptNumber;
}
public double getRent(){
return rent;
}
public int getTerm(){
return term;
}
public void addPetFee(){
rent = rent + FEE;
}
}
Create a class named TestLease as instructed below:
- Instantiate four Lease objects in the main()method.
- Change the aptNumber value for the first object to 20
- Change the rent value for the second object to 5000
- Change the term value for the forth object to 6
- Display the instance values for each of the instantiated objects
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images