Is this right? Questions-WAP using a function called area() to find area of circle, square and rectangle as per user's choice.
//To find the area of circle,square,and rectangle import java.io.*; class pubg { public double area(int r) { double arcircle=3.14*r*r; return(arcircle); } public int area(int s) { int arsquare=s*s; return(arsquare); } public int area(int l,int b) { int arrectangle=l*b; return(arrectangle); } public static void main(String args[])throws IOException { DataInputStream x=new DataInputStream(System.in); int r=0,q=0; double p=0, pubg ob= new pubg(); System.out.println("Enter the radius of circle"); int r1=Integer.parseInt(x.readLine()); p=ob.area(r1); System.out.println("Area of circle is:"+p); System.out.println("Enter the side of square"); int s1=Integer.parseInt(x.readLine()); q=ob.area(s1); System.out.println("Enter the length and breadth of rectangle"); int l1=Integer.parseInt(x.readLine()); int b1=Integer.parseInt(x.readLine()); r=ob.area(l1,b1); } }