//The Triangle Base Java Program//Teacher who is learning Java: Andy Goldstein//First, create a Scanner object. This will allow keyboard input from the user.import java.util.Scanner;//Second, write Java statements to prompt the user for the area and height of the triangle.//I need to first create the class declarationpublic class TriangleBaseCalculator {//Next I need to create the main methodpublic static void main(String[] args) {//Now I need to create a Scanner object to read input from the keyboardScanner input = new Scanner(System.in);//Now I need to create variables to store the area, height and base of the triangledouble area;double height;double base;//I want to print a message welcoming the user to the Triangle Base CalculatorSystem.out.println("---Welcome to the Triangle Base Calculator---");System.out.println("You have arrived just in time!");System.out.println(""); //Skipping a line to create some space//Now I want to ask the user for input for the area of the triangleSystem.out.println("Enter the area of the triangle you want to calculate: ");//Now I want to assign the user's answer to the area variable I createdarea = input.nextDouble();//Now I want to ask the user for input for the height of the triangleSystem.out.println("Enter the height of the triangle you want to calculate: ");//Now I want to assign the user's answer to the height variable I createdheight = input.nextDouble();//Good so far.//Next, I want to calculate the base of the triangle, based on the input entered by the user. The formula to calculate the area of a triangle is 1/2(base*height). So the base would be b = 2a/h. Let's do this!//I need to make sure the height is not equal to 0, since you cannot divide by zero. I'm going to work this into a conditional statementif (height > 0) {//I want to calculate and show the base of the trianglebase = (2 * area) / height;System.out.println("The base of the triangle is: " + base);} else {//I want to tell the user that they can't have 0 or a negative for the height.System.out.println("Warning Will Robinson! Danger! Danger! The height cannot be 0 or less than 0!!!!");}//Now I want to close the Scanner object so that I don't take up system resourcesinput.close();}}