Use the Java class you posted last week (corrected based on any feedback you may have received) and add encapsulation to it to include making all attributes private, adding constructor, and adding get and set methods. The main method should create an instance of the class and demonstrate the correct functionality of all the methods.
My original program is:
public static void main(String[] args) {
//Formula for AREA of triangle: Base X Height/ 2
Scanner sc = new Scanner(System.in);
int base,height;
float area;
System.out.println("Enter the base of your triangle: ");
base=sc.nextInt();
System.out.println("Enter the height of your triangle: ");
height=sc.nextInt();
area=(float)(base*height)/2;
System.out.println("The Area of your triangle is : "+area);
}
}