Lab10/17
import javax.swing.JOptionPane;
public class Untitle2{
public static void main(String[] args) {
String podString=
JOptionPane.showInputDialog("enter number a number:");
int numberOfpods=Integer.parseInt(podString);
String peaString=
JOptionPane.showInputDialog(
"enter another number of peas in a pod:");
int peasPerPod=Integer.parseInt(peaString);
int tatalNumberOfPeas=numberOfpods*peasPerPod;
JOptionPane.showMessageDialog(null,"The tatal number of peas="+tatalNumberOfPeas);
System.exit(0);
}
}
0 Comments:
Post a Comment
<< Home