1.) Declare the 3 variables needed for this problem:   b f…

  1.) Declare the 3 variables needed for this problem:   b for the base of a triangle,  h  for the height of a triangle, and a for the area of a triangle. 2.)  Initialize the base of the triangle to 3.0 and the height of the triangle to 4.0 3.) Write the code to use these variables to compute the area of a triangle (area is one-half base times height).4.) Print “The area of a triangle with base of ” + b + ” and height of ” + h + ” is ” + area5.)  Format the area of the triangle to 2 decimal places using System.out.printf   In main: public static void main (String args[]){        //Declare  and initialize the variables here       //Calculate the area of a triangle using the formula provided       //Print the message and format the area to 2 decimal places }      

Write the code that will declare a String variable named sta…

Write the code that will declare a String variable named state with the initial value of “Mississippi”, and will then print the location of the second occurrence of the letter ‘i’ in the state.  The output message will say “The location of the second i in Mississippi is 4”.  In main: public static void main(String args[]) {       //declare your variable(s) here and initialize       //find the location of the second ‘i’      //print that location }