Hi guys, please help me to convert this code to OOP approach that that contains a method.
I hope someone will response . Thanks in advance
import java.io.*; public class Project { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader( new InputStreamReader(System.in)); int ar[]=new int[100]; int n,i,j,pos,ch; System.out.print("Enter number of element : "); n=Integer.parseInt(br.readLine()); if(n<=99) { for(i=0;i<n;i++) { System.out.print("Enter any number : "); ar[i]=Integer.parseInt(br.readLine()); } do { System.out.println("1.Insert Element"); System.out.println("2.Delete Element"); System.out.println("3.Display Element"); System.out.println("4.Exit"); System.out.print("Enter your choice : "); ch=Integer.parseInt(br.readLine()); switch(ch) { case 1: System.out.print("Enter position number : "); pos=Integer.parseInt(br.readLine())-1; if(pos<=n) { for(j=n-1;j>=pos;j--) ar[j+1]=ar[j]; System.out.print("Insert a new Element : "); ar[j+1]=Integer.parseInt(br.readLine()); n++; } else System.out.println("Invalid Position"); break; case 2: System.out.print("Enter position number : "); pos=Integer.parseInt(br.readLine())-1; if(pos<=n) { for(j=pos;j<n;j++) ar[j]=ar[j+1]; System.out.println("Element Deleted"); n--; } else System.out.println("Invalid Position"); break; case 3: for(i=0;i<n;i++) System.out.print(ar[i]+"\t"); System.out.println(); break; case 4: System.out.println("Thank You!"); System.exit(0); break; default: System.out.println(ch + " is not available at the choices"); System.out.println("Please enter again!"); } }while(ch != 4 ); } else System.out.println("Out of bound!"); } }