Hi trayyrho, welcome to </dream.in.code>

Now here is a code that works, and I only had to do a few changes.
CODE
import java.util.*;
import javax.swing.JOptionPane;
public class SimpleMath
{
public static void main(String [] args)
{
double firstInteger = Integer.parseInt(JOptionPane.showInputDialog(null,"Type in the first integer:"));
double secondInteger = Integer.parseInt(JOptionPane.showInputDialog(null,"Type in the second integer:"));
double sum = firstInteger + secondInteger;
double difference = firstInteger - secondInteger;
double product = firstInteger * secondInteger;
double quotient = firstInteger / secondInteger;
System.out.println("sum: " + sum);
System.out.println("difference: " + difference);
System.out.println("product: " + product);
System.out.println("quotient: " + quotient);
JOptionPane.showMessageDialog(null,"sum: "+sum+"\ndifference: "+difference+"\nproduct: "+product+"\nquotient: "+quotient);
}
}
Now let me explain, what I did. First in the code you posted you don't have a main() function. In almost every program you'll have a main() function, so that the program will work, the function is:
CODE
public static void main(String [] args)
{
// CODE HERE
}
And now in the code I used JOptionPane.
NOTE: for every new function or class try to read it's functionalities and constructs from the Java API, see the link below:
http://java.sun.com/javase/6/docs/api/index.htmlAnother very awesome alternative people use these last 9 yrs is Google

So I hope that you find this useful. And below is a code that works in the way you tried it:
CODE
import java.util.*;
public class SimpleMath
{
public static void main(String [] args)
{
System.out.println("Type in the first integer");
Scanner sc = new Scanner(System.in);
double firstInteger = sc.nextInt();
System.out.println("Type in the second integer");
sc = new Scanner(System.in);// NO NEED FOR Scanner in front of sc
double secondInteger = sc.nextInt();
double sum = firstInteger + secondInteger;
double difference = firstInteger - secondInteger;
double product = firstInteger * secondInteger;
double quotient = firstInteger / secondInteger;
System.out.println("sum: " + sum);
System.out.println("difference: " + difference);
System.out.println("product: " + product);
System.out.println("quotient: " + quotient);
}
}
One more thing in the code you posted you define the same Scanner twice.
You shouldn't do that because there is no need and because it is an error for the compiler at least. I commented that in the last code.
So as I said I hope you find this useful and I hope you
learn from it.
Enjoy
This post has been edited by PennyBoki: 10 Oct, 2007 - 12:48 AM