import java.util.
Scanner;
import java.util.Vector;
public class Main {
    Vector<String> nameVector = new Vector();
    Vector<String> emailVector = new Vector();
    Vector<Integer> ageVector = new Vector();
    Scanner scan;
    String name;
    String email;
    int age;
    int menu;
   public void delete() {
       int delete = true;
       System.out.print("Choose number you want to delete : ");
       int delete = this.scan.nextInt();
       this.scan.nextLine();
       this.nameVector.remove(delete - 1);
       this.emailVector.remove(delete - 1);
       this.ageVector.remove(delete - 1);
   }
   public void update() {
       int update = true;
       System.out.print("Choose number you want to update : ");
       int update = this.scan.nextInt();
       this.scan.nextLine();
       System.out.println("Student you want to update : ");
       System.out.println("Name : " + (String)this.nameVector.get(update - 1));
       System.out.println("Email : " + (String)this.emailVector.get(update - 1));
       System.out.println("Age : " + this.ageVector.get(update - 1));
       System.out.println("Please update the data : ");
       do {
           do {
               System.out.print("Input student's name [5-10 Characters]: ");
               this.name = this.scan.nextLine();
           } while(this.name.length() < 5);
       } while(this.name.length() > 10);
       do {
            System.out.print("Input student's email [Must be ended with
'@gmail.com']: ");
            this.email = this.scan.nextLine();
        } while(!this.email.endsWith("@gmail.com"));
       do {
           System.out.print("Input student's age [Must be greater than 15]: ");
           try {
               this.age = this.scan.nextInt();
               this.scan.nextLine();
           } catch (Exception var3) {
               System.out.println("System Error ! Must be number !");
              }
          } while(this.age <= 14);
          this.nameVector.set(update - 1, this.name);
          this.emailVector.set(update - 1, this.email);
          this.ageVector.set(update - 1, this.age);
      }
      public void mainMenu() {
          System.out.println("!Mahasiswa!");
          System.out.println("1. Insert data");
          System.out.println("2. View data");
          System.out.println("3. Delete data");
          System.out.println("4. Update data");
          System.out.println("5. Exit");
          System.out.print("Choose >> ");
      }
    public void viewData() {
        for(int i = 0; i < this.nameVector.size(); ++i) {
            System.out.printf("%d. %s - %s - %d \n", i + 1, this.nameVector.get(i),
this.emailVector.get(i), this.ageVector.get(i));
        }
      public Main() {
          this.scan = new Scanner(System.in);
          this.name = "";
          this.email = "";
          this.age = 0;
          this.menu = 0;
          do {
              this.mainMenu();
              this.menu = this.scan.nextInt();
              this.scan.nextLine();
              switch(this.menu) {
              case 1:
                  do {
                       do {
                            System.out.print("Input student's name [5-10 Characters]: ");
                            this.name = this.scan.nextLine();
                       } while(this.name.length() < 5);
                  } while(this.name.length() > 10);
                  do {
                      System.out.print("Input student's email [Must be ended with
'@gmail.com']: ");
                      this.email = this.scan.nextLine();
                  } while(!this.email.endsWith("@gmail.com"));
                  do {
                      System.out.print("Input student's age [Must be greater than 15]:
");
                   try {
                       this.age = this.scan.nextInt();
                       this.scan.nextLine();
                   } catch (Exception var2) {
                       System.out.println("System Error ! Must be number !");
                   }
               } while(this.age <= 14);
                this.nameVector.add(this.name);
                this.emailVector.add(this.email);
                this.ageVector.add(this.age);
                break;
            case 2:
                this.viewData();
                break;
            case 3:
                this.delete();
                break;
            case 4:
                this.update();
            }
        } while(this.menu != 5);
    public static void main(String[] args) {
        new Main();
    }
}