Untitled

 avatar
unknown
plain_text
2 years ago
1.7 kB
4
Indexable
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Main 
{   
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int choice = 0;
        ArrayList<MaltesePlayers> F = new ArrayList<MaltesePlayers>();
        MethodClass fr = new MethodClass();
        do{
            try{
                String s = JOptionPane.showInputDialog(null, "0. Exit\n1. Add Record\n2. Edit Record\n3. Delete Record\n4. Display Record\n5. Search Record\n6. Sort Record", JOptionPane.INFORMATION_MESSAGE);
                choice = Integer.parseInt(s);
            }
            catch(Exception e)
            {
                System.out.println("Error");
                choice = 8;
            }

            switch(choice)
            {
                case 0: System.out.println("Exiting the system");break;
                case 1: fr.AddRecord(F); break;
                case 2: fr.EditRecord(F);break;
                case 3: fr.DeleteRecord(F);break;
                case 4: fr.DisplayRecord(F); break;
                case 5: fr.SearchRecord(F); break;
                case 6: fr.SortRecord(F);break;
                default: if(choice ==8)
                            {
                                     System.out.println("Type mismatch"); 

                             }
                         else

                            {
                                     JOptionPane.showMessageDialog(null, "Invalid Choice", "Error", JOptionPane.ERROR_MESSAGE);
                            }
                            break;
        }
        
    }
    while(choice !=0); 
}
}

Editor is loading...