What's new

Help Newbie lang po patulong po nito if papano gawin po ito

raigan

Honorary Poster
Joined
Apr 29, 2015
Posts
391
Reaction
77
Points
152
Expected output :
-INSERT
-REMOVE
-UPDATE (NEW ADDED)
-SEARCH
-DISPLAY


package com.mycompany.employeelist;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class STUDENT{

String Student_id;
String last_name;
String first_name;
String email;

public STUDENT(String Student_id, String last_name, String first_name, String email) {
this.Student_id = Student_id;
this.last_name = last_name;
this.first_name = first_name;
this.email = email;
}


}



public class studentInfo {

public static Scanner scanner = new Scanner(System.in);
public static List<STUDENT> toAddStudent = new ArrayList<>();
public static String actions;

public static void main(String[] args) {
menu();
}

public static void menu(){

//insert the first batch of student
inserted_student();
System.out.println("-----STUDENT LIST-----");
//display after the student inserted
fetch_student();

System.out.println();

System.out.println("[1] Add Student");
System.out.println("[2] Remove Student");
System.out.println("[3] Search Student");

System.out.println();
System.out.println("Select your Action:");
actions = scanner.next();

if(actions.equals("1"))
{insert_student();}
else if(actions.equals("2"))
{remove_student();}
else if(actions.equals("3"))
{search_student();}
}

// display the data
public static void fetch_student(){
int count=0;
for(STUDENT list:toAddStudent)
{
count++;
System.out.println(count+" |"+list.Student_id +" |"+ list.last_name +" |"+list.first_name +" |"+ list.email);
}

}
//insert 4 student
public static void inserted_student(){

toAddStudent.add(new STUDENT("02-19-1239","Angcay","Barbiey Jean","BarbieyJean@gmail.com"));
toAddStudent.add(new STUDENT("02-19-1283","Mong ","Debby Ela ","DebbyEla@gmail.com"));
toAddStudent.add(new STUDENT("02-17-0413","Gulfan","Gian Jake L ","GianJakeL@gmail.com"));
toAddStudent.add(new STUDENT("02-19-1267","Pamisa","Dale Kristan","DaleKristan@gmail.com"));

}
//insert new student
public static void insert_student(){

String id, last_name,first_name,email;

System.out.println("Student Id: ");
id =scanner.next();
System.out.println("Lastname: ");
last_name =scanner.next();
System.out.println("Firstname: ");
first_name =scanner.next();
System.out.println("Email: ");
email =scanner.next();

toAddStudent.add(new STUDENT(id,last_name,first_name,email));


}
//remove a student
public static void remove_student(){

System.out.println("implement the code here!!..");
System.out.println("remove the student info using student ID");
}
//search a student
public static void search_student(){
System.out.println("implement the code here!!..");
System.out.println("search the student info using student ID");
}
}
 
Back
Top