hab folgende fehlerausgabe. weiß aber nicht wie ich ihn beseitige
possible loss of precision
found : double
required: int
int e=(((3*e1*e1 * e2) / 2) * Math.sqrt(3)) ;
^
[Edit by Beni: Codetags repariert]
possible loss of precision
found : double
required: int
int e=(((3*e1*e1 * e2) / 2) * Math.sqrt(3)) ;
^
Code:
import javax.swing.*;
//import java.awt.*;
//import java.awt.event.*;
class eingabe_6eckiges_Prisma_Würfel
{
public static void main(String[] args)
{
String s;
String h;
s = JOptionPane.showInputDialog( null,"Geben Sie bitte die Seitenlänge ein in cm:" );
h = JOptionPane.showInputDialog( null,"Geben Sie bitte die Höhe ein in cm:" );
int e1 = Integer.parseInt(s);
int e2 = Integer.parseInt(h);
int e=(((3*e1*e1 * e2) / 2) * Math.sqrt(3)) ;
JOptionPane.showMessageDialog(null, "Das Volumen ist:"+ (e) +"cm³");
}
}
[Edit by Beni: Codetags repariert]