I am working on the following:

To write a class that works with another programmer’s class.
This week, I’ll give you a class called TrigEssentials.java. TrigEssentials:
• Stores a double value for side A of a right triangle
• Stores a double value for side B of a right triangle
• Calculates a double value for the triangle’s hypotenuse
• Calculates a double value for angle a
• Calculates a double value for angle b
• Prints out results
Assignment:
• Create a TrigInteractor.java to work with TrigEssentials
• 2 methods:
o intro( )
o calculate( )
• Use while loop/s
• Use if statements and nested if statements
• Use try/catch

**Note** The right triangle that I drew with print statements has no relevance to the actual lengths being input for sides a and b. It will always be the same triangle pic, regardless of what the sides are (notice in the output that the side lengths don’t match the picture – that’s ok, and unimportant). What is important is that the 3 lengths are in accordance with Pythagorean Theorem.
Output:

(First Method – intro())
*****Welcome to the MSTU Trig Calculator*****
Question - Will you be using our calculator for class, or just for fun? (C / F): class
Sorry - we need a C or F: c
Great - High School or University (H / U): x
Sorry - We need an H or U: U
Our program addresses university level topics - enjoy!
(Second Method – calculate())
Calculate or Quit (C / Q): calculate Sorry, we need a C or Q: c
This Program:
* Finds the hypotenuse of a right triangle * Calculates angles a and b
Length of Side A: seven ***ERROR – INVALID INPUT***
Calculate Again or Quit (C / Q): C
This Program:
* Finds the hypotenuse of a right triangle * Calculates angles a and b
Length of Side A: 34.98 Length of Side B: 56.32
********************Results********************
Side a: 34.98
|\
|\
|\
|\
|B\
|\
|\
| \ Hypotenuse: 66.30 |\
|\
| \ |\ |____ \ ||\ |C|A\ |____|____________\
Side b: 56.32
Angle A is: 58.16 degrees
Angle B is: 31.84 degrees
Angle C is always 90.00 degrees (For right triangles) Total: 180.00 degrees
************************************************** Calculate Again or Quit (C / Q): quit
Sorry, we need a C or Q: q
Thank you
[FONT=Arial Black]
Here is the code I was given:



/**
* TrigUser.java
*
* This class:
* a) stores sideA and sideB of a right triangle (these I get from the user)
* b) calculates a hypotenuse based on sideA and sideB (my getHypotenuse() method calculates and returns this value)
* c) calculates angleA (my getAngleA() method calculates and returns this value)
* d) calculates angleB (my getAngleB() method calculates and returns this value)
* e) contains 2 methods that will print out results (printHypResults(), printAngleResults())
* f) uses the Math class
* g) uses the DecimalFormat class
*
*/
import java.lang.Math;
import java.text.DecimalFormat;
public class TrigEssentials
{
//declaring my istance variables
//double to hold a value for side a
private double sideA;
//double to hold a value for side b
private double sideB;
//double to hold a value for Hypotenuse
private double hypotenuse;
//double to hold a value for angle A
private double angleA;
//double to hold a value for angle B
private double angleB;
//variable to hold a DecimalFormat object
private DecimalFormat formatter;

/**
* Constructor for class TrigUser
* instance variables will get initialized here in the constructor
*/
public TrigEssentials()
{
sideA = 0;
sideB = 0;
hypotenuse = 0;
angleA = 0;
angleB = 0;
formatter = new DecimalFormat("#0.00");

}

/**
* Sets side a
* @param newSideA side a
*
* You'll need to get this from the user
*/
public void setSideA(double newSideA)
{
sideA = newSideA;
}

/**
* Sets side b
* @param newSideB side b
*
* You'll need to get this from the user
*/
public void setSideB(double newSideB)
{
sideB = newSideB;
}

/**
* Returns side a
* @return sideA side a
*/
public double getSideA()
{
return sideA;
}

/**
* Returns side b
* @return sideB side b
*/
public double getSideB()
{
return sideB;
}

/**
* Method to generate hypotenuse
* I'm using the Math.hypot method - no need for me to calculate it myself!
*
* @return hypotenuse hypotenuse
*/
public double getHypotenuse()
{
hypotenuse = Math.hypot(getSideA(), getSideB());
return hypotenuse;
}

/**
* Returns angle A
* @return angleA angle A
*
* The sine of an angle is equal to (opposite side / hypotenuse)
* So, the sine of angle A is (sideB / hypotenuse)
*
* The angle value is the inverse of the sine
* Math.asin is an inverse trig function to generate that value
* BUT - Math.asin brings back a value in radians, and
* I want a value in degrees, so that's why I'm using the Math.toDegrees method
*/
public double getAngleA()
{
double angleAInRadians = Math.asin(getSideB() / getHypotenuse());
angleA = Math.toDegrees(angleAInRadians);
return angleA;
}

/**
* Returns angle B
* @return angleB angle B
*
* The sine of an angle is equal to (opposite side / hypotenuse)
* So the sine of angle B is (sideA / hypotenuse)
*
* The angle value is the inverse of the sine
* Math.asin is an inverse trig function to generate that value
* BUT - Math.asin brings back a value in radians, and
* I want a value in degrees, so that's why I'm using the Math.toDegrees method
*/
public double getAngleB()
{
double angleBInRadians = Math.asin(getSideA() / getHypotenuse());
angleB = Math.toDegrees(angleBInRadians);
return angleB;
}

/**
* My 2 methods to print out results
*

/**
* Method #1 - method to:
* a) display a right triangle
* b) print out values for sideA, sideB, and hypotenuse
* c) values are formatted to 2 digits after the decimal point
*/
public void printHypResults()
{
System.out.println("\n********************Results********************");
System.out.println("\n\t\t|\\");
System.out.println("\t\t| \\");
System.out.println("\t\t|B \\");
System.out.println("\t\t| \\");
System.out.println("\t\t| \\");
System.out.println("\t\t| \\");
System.out.println("\t\t| \\");
System.out.println("\t\t| \\ Hypotenuse: " + formatter.format(getHypotenuse()));
System.out.println("\t\t| \\ ");
System.out.println("\t\t| \\");
System.out.println("Side a: " + formatter.format(getSideA()) + "\t| \\");
System.out.println("\t\t| \\");
System.out.println("\t\t|____ \\");
System.out.println("\t\t| | \\");
System.out.println("\t\t| C | A \\");
System.out.println("\t\t|____|__________\\");
System.out.println(" ");
System.out.println("\t\t Side b: " + formatter.format(getSideB()));

}

/**
* Method #2 - method to:
* a) print out angle calculations
* b) add up the angles in a right triangle (should add up to 180.0)
*/
public void printAngleResults()
{
System.out.println("\nAngle A is: " + formatter.format(getAngleA()) + " degrees");
System.out.println("Angle B is: " + formatter.format(getAngleB()) + " degrees");
System.out.println("Angle C is always 90.00 degrees (For right triangles)");
System.out.println("Total: " + formatter.format((90.00 + getAngleA() + getAngleB())) + " degrees");
System.out.println("\n**************************************************");
}

}

How do I create the class to work with this????