anyone can make a program which will... ADD DELETE UPDATE AND SEARCH DATA/INFORMATION.. ohh java source code i mean using graphical user interface.. ive got an example here "student profile" its not complete yet mmm..
package studentproject;
/** * * @author Cisco_lab */
import javax.swing.JOptionPane;
public class StudentProfile2{
public static void main(String[] args) {
String output = "", name, up; double m, e,s; Student [] student = new Student[5];
int i=0; int u=0,f=0;
String choice, again; char c,ans;
do{ choice = JOptionPane.showInputDialog(" MENU " + "\n" + "[a] ADD a RECORD " + "\n" + "[d] DISPLAY RECORDs" +"\n" + "[e] DELETE a RECORD"+"\n" + "[p] UPDATE a RECORD"+"\n" + "[s] SEARCH a RECORD"+"\n" + "Enter choice: ");
choice = choice.trim(); c = choice.charAt(0);
switch(c){ case 'a': student = new Student(); name=JOptionPane.showInputDialog(" Enter name: "); student.setName(name);
String mg = JOptionPane.showInputDialog("Name: "+name + "\nEnter Math Grade "); m = Double.parseDouble(mg); student.setmGrade(m); String eg = JOptionPane.showInputDialog("Name: "+name + "\nEnter English Grade "); e = Double.parseDouble(eg); student.seteGrade(e); String sg = JOptionPane.showInputDialog("Name: "+name + "\nEnter Science Grade "); s = Double.parseDouble(sg); student.setsGrade(s);
i++;
break;
case 'd': if (i==0) JOptionPane.showMessageDialog(null,"NO RECORDS yet!!!");
up = JOptionPane.showInputDialog("Enter name to search: "); for(int x=0; x<i; x++){ if ((student[x].getName().equalsIgnoreCase(up))){ u=x; f=1; JOptionPane.showMessageDialog(null,"FILE FOUND!!!"); break; } }
JOptionPane.showMessageDialog(null,output); } else JOptionPane.showMessageDialog(null,"NAME DOES EXIST!!!");
break;
case 'p':
up = JOptionPane.showInputDialog("Enter name to update: "); for(int x=0; x<i; x++){ if ((student[x].getName().equalsIgnoreCase(up))){ u=x; f=1; JOptionPane.showMessageDialog(null,"FILE FOUND!!!"); break; } } if(f==1){
name=JOptionPane.showInputDialog(" Enter name: "); student.setName(name);
mg = JOptionPane.showInputDialog("Name: "+name + "\nEnter Math Grade "); m = Double.parseDouble(mg); student.setmGrade(m); eg = JOptionPane.showInputDialog("Name: "+name + "\nEnter English Grade "); e = Double.parseDouble(eg); student.seteGrade(e); sg = JOptionPane.showInputDialog("Name: "+name + "\nEnter Science Grade "); s = Double.parseDouble(sg); student.setsGrade(s); JOptionPane.showMessageDialog(null,"FILE SUCCESSFULLY UPDATED!!!"); } else JOptionPane.showMessageDialog(null,"NAME DOES EXIST!!!");
break;
case 'e': up = JOptionPane.showInputDialog("Enter name to delete: "); for(int x=0; x<i; x++){ if ((student[x].getName().equalsIgnoreCase(up))){ u=x; f=1; JOptionPane.showMessageDialog(null,"FILE FOUND!!!"); break; } } if(f==1){
student=null;
for(m=u; m<i; m++){ student = student[u+1]; }
JOptionPane.showMessageDialog(null,"FILE SUCCESSFULLY DELETED!!!"); i--; } else JOptionPane.showMessageDialog(null,"NAME DOES EXIST!!!");
break;
}
again = JOptionPane.showInputDialog("Another transaction? [y/n]"); again=again.trim(); ans=again.charAt(0); }while(ans=='y'||ans=='Y');
}
}
package directoryproject;
/** * * @author Cisco_lab */ public class Student {
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here