Output a Two Decimal Value
It's suppose to display 12.50 but instead it's displaying 0.0 :(whew):
Code:
import java.io.*;
public class InputOutput {
public static void main(String[] args) {
String base="";
String height="";
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.print("Input base value = ");
base = input.readLine();
System.out.print("Input height value = ");
height = input.readLine();
} catch(IOException e) {
System.out.print("Error");
}
float area = 1/2*(Integer.parseInt(base)* Integer.parseInt(height));
System.out.println("The Area of the right triangle is "+ area);
}
}