Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the code for a class named Kent. You will use this class in creating a c

ID: 3573656 • Letter: H

Question

Here is the code for a class named Kent. You will use this class in creating a class as described below.

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.

The class has a constructor with two parameters: an int and a Kent object, in that order. The constructor initializes the two instance variables using the parameter values.

There is a method with the header

that returns the sum of the ascent and the factor of base.

Explanation / Answer

Here is the code for Essex.java:

//Create a class named Essex with the following characteristics:
class Essex
{
//The class has in instance variable, ascent, of integer type.
int ascent;
//The class has an instance variable, base, that is an object of class Kent.
Kent base;
//The class has a constructor with two parameters: an int and a Kent object, in that order.
//The constructor initializes the two instance variables using the parameter values.
public Essex(int x, Kent y)
{
ascent = x;
base = y;
}
//There is a method with the header public int getApex() that returns the sum of the ascent and the factor of base.
public int getApex()
{
return ascent + base.getFactor();
}
}