Ok so I have this code:
import javax.swing.JOptionPane; public class testing{ public static void main (String arg[]){ int Answer=0; String Sa=""; String Sb=""; Sa = JOptionPane.showInputDialog(null, "Enter the dividend."); Sb = JOptionPane.showInputDialog(null, "Enter the divisor."); int IntFormSa = Integer.parseInt(Sa); int IntFormSb = Integer.parseInt(Sb); Answer = IntFormSa / IntFormSb; JOptionPane.showMessageDialog(null, "The quotient is "+Answer); System.exit(0); } }
The problem is, when I enter two numbers that should divide to equal a decimal answer, it rounds to a seemingly random integer. It's not the closest integer because when I input 2 and 3 for the dividend and divisor it says that the quotient is 0 yet it should be .6 repeating. Anyone know how to fix this so that it gives the exact decimal?