Here is the code for a class named Kent. You will use this class in creating a c
ID: 3853049 • Letter: H
Question
Here is the code for a class named Kent. You will use this class in creating a class as described below. (10 points)
public class Kent {
private int factor;
public int getFactor() {
return factor;
}
public void setFactor(int factor) {
this.factor = factor;
}
}
Create a class named Essex with the following characteristics:
The class has in instance variable, ascent, of integer type.
The class has an instance variable, base, that is an object of class Kent.
There is a method with the header
public int getApex()
//that returns the sum of the ascent and the factor of base.
do not copy existing answer on chegg
Explanation / Answer
public class Kent {
private int factor;
public int getFactor() {
return factor;
}
public void setFactor(int factor) {
this.factor = factor;
}
}
public class Essex {
static int ascent=0;
static int getApex(){
return (ascent+fact);
}
static int fact=0;
public static void main(String[] args){
Kent k =new Kent();
k.setFactor(5);
fact=k.getFactor();
System.out.print(getApex());
}
}