CODING:
import javax.swing.JOptionPane;
class CalArea
{
public static void main(String[] args)
{
String s=JOptionPane.showInputDialog(null, "Enter Side", "Calculate the area of S Square", JOptionPane.PLAIN_MESSAGE);
Area(Integer.parseInt(s));
String l=JOptionPane.showInputDialog(null, "Enter Length", "Calculate the area of R Rectangle", JOptionPane.PLAIN_MESSAGE);
String w=JOptionPane.showInputDialog(null, "Enter Width", "Calculate the area of R Rectangle", JOptionPane.PLAIN_MESSAGE);
Area(Integer.parseInt(l),Integer.parseInt(w));
}
public static void Area(int s)
{
JOptionPane.showMessageDialog(null,"Area of S square: " + s*s);
}
public static void Area(int l,int w)
{
JOptionPane.showMessageDialog(null,"Area of R Rectangle: " + l*w);
}
}
class CalArea
{
public static void main(String[] args)
{
String s=JOptionPane.showInputDialog(null, "Enter Side", "Calculate the area of S Square", JOptionPane.PLAIN_MESSAGE);
Area(Integer.parseInt(s));
String l=JOptionPane.showInputDialog(null, "Enter Length", "Calculate the area of R Rectangle", JOptionPane.PLAIN_MESSAGE);
String w=JOptionPane.showInputDialog(null, "Enter Width", "Calculate the area of R Rectangle", JOptionPane.PLAIN_MESSAGE);
Area(Integer.parseInt(l),Integer.parseInt(w));
}
public static void Area(int s)
{
JOptionPane.showMessageDialog(null,"Area of S square: " + s*s);
}
public static void Area(int l,int w)
{
JOptionPane.showMessageDialog(null,"Area of R Rectangle: " + l*w);
}
}
Comments
Post a Comment