#program returning specific result

1 messages · Page 1 of 1 (latest)

mossy quest
#

`
import javax.swing.JOptionPane;

public class gui {
public static void main (String[] args){
JOptionPane.showMessageDialog(null, "Hypotenusa");

    int base = Integer.parseInt(JOptionPane.showInputDialog("What is the base"));
    int height = Integer.parseInt(JOptionPane.showInputDialog("What is the height"));

    double hypotenuse = Math.sqrt((base*base) + (height*height));

    JOptionPane.showMessageDialog(null, "The Hypotenuse is: " + hypotenuse);




}

}`

thin dustBOT
#

<@&987246487241105418> please have a look, thanks.

mossy quest
#

the answer should be 7

woven zephyr
#

try the math on a calculator. If its the same result , then the output has be rounded

#

but since your using pythogoras's , that hardly reaches a whole number

mossy quest
#

5 and 6

#

oh wait

#

understood my mistake

#

how to close thread

#

wait guys

#

do you guys have nay recommendations for some project

#

which uses scanner and gui

#

also math module

slender copper
woven zephyr
#

how about a calculator with some functions on it

#

but why would u want to use scanner on a gui ?

slender copper