java, plz help me in doing this

java, plz help me in doing this

# Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List Records. Each Record contains: Name(max 100 char), Age, Notes(No Maximum Limit). No database should be used. All data must be stored in one or two files. Listing records should print the names of the users in alphabetical order. And the important thing is, total file should not be re-written for every add/delete operation.
View Answers

January 4, 2010 at 10:55 AM

Hi Friend,

Try the following code:
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;

class StudentApplication {
JFrame f;
JPanel p1,p2,p3,p,p4;
JTabbedPane tp;
ImageIcon btnimg1,btnimg2;
JLabel l1, l2, l3, l4,l5,l6,l7,l8,l9,l10;
JTextField tf1,tf2,tf3,tf4,tf5,tf6,tf7,tf8,tf9,tf10;
JScrollPane sp1;
JButton savebtn,resetbtn,editbtn1,editbtn2,delBtn,viewBtn;
StudentApplication(){
f=new JFrame("Form");
p=new JPanel(new GridLayout(2,1));
p1=new JPanel(new GridLayout(5,2));
p2=new JPanel(new GridLayout(5,2));
p3=new JPanel(new GridLayout(2,2));
p4=new JPanel();
tp=new JTabbedPane();
l1=new JLabel("ID:");
l2=new JLabel("Name:");
l3=new JLabel("Age:");
l4=new JLabel("Notes:");
l5=new JLabel("Enter ID to delete Record:");
l7=new JLabel("ID:");
l8=new JLabel("Name:");
l9=new JLabel("Age:");
l10=new JLabel("Notes:");
tf1=new JTextField(12);
tf2=new JTextField(12);
tf3=new JTextField(12);
tf4=new JTextField(12);
tf5=new JTextField(12);
tf6=new JTextField(12);
tf7=new JTextField(12);
tf8=new JTextField(12);
tf9=new JTextField(12);
tf10=new JTextField(12);
savebtn=new JButton(" Add ");
resetbtn=new JButton(" Reset");
editbtn1=new JButton(" Edit ");
editbtn2=new JButton(" Save");
delBtn=new JButton("Delete");
viewBtn=new JButton("View");
final JTextArea area=new JTextArea(10,20);
final JScrollPane pane=new JScrollPane(area);
p1.add(l1);
p1.add(tf1);
p1.add(l2);
p1.add(tf2);
p1.add(l3);
p1.add(tf3);
p1.add(l4);
p1.add(tf4);
p1.add(savebtn);
p1.add(resetbtn);
p2.add(l7);
p2.add(tf7);
p2.add(l8);
p2.add(tf8);
p2.add(l9);
p2.add(tf9);
p2.add(l10);
p2.add(tf10);
p2.add(editbtn1);
p2.add(editbtn2);
p3.add(l5);
p3.add(tf5);
p3.add(delBtn);
p.add(p3);
p4.add(pane);
p4.add(viewBtn);
pane.setVisible(false);

resetbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
}
});
savebtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value1=tf1.getText();
String value2=tf2.getText();
String value3=tf3.getText();
String value4=tf4.getText();
try{
File file=new File("school.txt");
FileWriter fstream = new FileWriter(file,true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(value1+" "+value2+" "+value3+" "+value4);
out.newLine();
out.close();
JOptionPane.showMessageDialog(null,"Data is successfully inserted.");
}
catch(Exception e){}
}
});

January 4, 2010 at 10:56 AM

continue..

delBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
File f1=new File("new.txt");
File f2=new File("school.txt");
try{
String value=tf5.getText();
BufferedWriter output= new BufferedWriter(new FileWriter(f1));
BufferedReader freader =new BufferedReader(new FileReader(f2));
String s;
while ((s=freader.readLine())!=null){
String []f = s.split(" ");
String id = f[0];
String name = f[1];
String c = f[2];
String note = f[3];
if (!id.equals(value) ){
output.write(s );
output.newLine();
}
}
freader.close();
output.close();
}
catch(Exception e){}
f2.delete();
f1.renameTo(f2);
}
});
editbtn1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value=tf7.getText();
File f=new File("school.txt");
try{
BufferedReader freader =new BufferedReader(new FileReader(f));
String s;
while ((s=freader.readLine())!=null){

String []st = s.split(" ");
String id = st[0];
String name = st[1];
String c = st[2];
String note = st[3];
if (id.equals(value) ){
tf7.setText(id);
tf8.setText(name);
tf9.setText(c);
tf10.setText(note);
}
}
freader.close();
}
catch(Exception e){}

}
});
editbtn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String t1=tf7.getText();
String t2=tf8.getText();
String t3=tf9.getText();
String t4=tf10.getText();
File f3=new File("new.txt");
File f4=new File("school.txt");
try{

BufferedWriter output= new BufferedWriter(new FileWriter(f3));
BufferedReader freader =new BufferedReader(new FileReader(f4));
String s;
while ((s=freader.readLine())!=null){
String []f = s.split(" ");
String id = f[0];
String name = f[1];
String c = f[2];
String note = f[3];
if (!id.equals(t1) ){
output.write(s );
output.newLine();
}
}
freader.close();
output.write(t1+" "+t2+" "+t3+" "+t4);
output.close();
}
catch(Exception e){}
f4.delete();
f3.renameTo(f4);
}
});
viewBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
pane.setVisible(true);
try{
FileReader fr = new FileReader("school.txt");
BufferedReader myInput = new BufferedReader(fr);

String s;
StringBuffer b = new StringBuffer();
while ((s = myInput.readLine()) != null) {
b.append(s);
b.append("\n");
}
area.setText(b.toString());
}
catch(Exception e){}
}
});
f.getContentPane().add(tp);
tp.addTab("View Record",p4);
tp.addTab("Add Record",p1);
tp.addTab("Edit Record",p2);
tp.addTab("Delete Record",p);
f.setSize(450,180);
f.setVisible(true);
}
public static void main(String z[]){
StudentApplication app=new StudentApplication();
}
}
Hope that it will be helpful for you.
Thanks

March 9, 2010 at 8:32 PM

The answer above..giving me the error of NoClassDefFoundError...









Related Tutorials/Questions & Answers:
java, plz help me in doing this - Java Beginners
java, plz help me in doing this  # Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record.....giving me the error of NoClassDefFoundError
help me for doing project - Java Beginners
help me for doing project  i am handling the project that "email... the email headers and how to display the port and user's information please help me thanks in advance who are going to help me bhanukiran
Advertisements
plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong
plz help me - Java Beginners
plz help me  Hi, I want to search all field from database using name, and display in text box, then data is update and delete. i want to search name using alphabets a-z, plz reply fast. plz help me this is very urgent
plz Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief
plz help me - Java Beginners
plz help me  Thanks deepak continue response..i face some problem i... is true...but i very confuse that how it is not displayed admin page plz any one give me reponse my persinal given id  Hi ragni, i am sending
plz help me - Java Beginners
plz help me  deepak hw can i create a data grid in jsp and also how can i connect to the data base plz help me  to create data grid in jsp use html tables with borders. to connect to data base use scriptlets. ex
plz help me today plz plz - Java Interview Questions
plz help me today plz plz  2.) Suppose list is an array of six elements of type int. What is stored in list after the following java code executes? . for (i = 0; i < 5; i++) { list[i] = 2 * i + 5
Help me quickly plz??
Help me quickly plz??  Can you help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers plz help quickly
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Help me plz in Probablity distribution of Java
Help me plz in Probablity distribution of Java  Hello, I have...% is insert or update queries. Which distribution to use and how to achieve it.. Plz help thanks for your time
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 â?¤ 200; 3x1 + 5x2 â?¤ 150; 5x1 + 4x2 â?¥ 100; 8x1 + 4x2 â?­â?¥ 80, x1 â?¥ 0, x2 â?¥ 0
Plz help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123"; String t = "12"; String w = t + "3"; Boolean b = o.equals (a); Boolean b2
help me plz - Java Interview Questions
help me plz  1)write a java program that prompts the user to input a decimal number and print the number rounded to the nearest integer? 2)write...? plz answer my question   Hi Friend, Try the following code: 1
Help Me With This Plz - Java Interview Questions
Help Me With This Plz  Write a program that's print a word like(I S E) on the black screen with 0,1 only by using two dimensional array? the 1's will represent the words
plz help me - Java Interview Questions
plz help me  1)Rewrite the method in exercise 10 such that it use the binary search algorithm instead. the linear search algorithm is suitable... . use linear search for this algorithm .then test your method in java application
Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40... traffic light on the frame. We have used java swing. It may help you. import
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
plz help me!!!!!!!! - JSP-Servlet
plz help me!!!!!!!!  i`ve set the environment varaibles for tomcat... there are compilation errors.. plz do help me.   make sure that you did... html file,.java file and xml file.. under which directory or folder i`ve to save
plz help me to create gui using Java netbeans
plz help me to create gui using Java netbeans  Hi, I am unable to fetch a particular data from DB.I am using netbeans for creating GUI. If I want.... I am unable to fetch the particular data. Plz help me   Hi Friend
Intranet Website creation - plz help me
Intranet Website creation - plz help me   hi.. I have assign with the intranet website creation work..right from scratch to end..And honestly I know nothing about it.My domain is totally different .. can anybody pls help me
facing problem plz help me out - Framework
Facing problem plz help me out  hi i am new to servlet i deployed... the web.xml file too parallel to the classes folder now i am facing this problem.plz tell me what to do... error:The requested resource (Servlet servlet
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
help me plz befor 27 februry
help me plz befor 27 februry  what is rung with this ?? help me plzzzz import java.util.Scanner; public class Initials { public static void main (String [] args) { String firstname,lastname
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
interview question plz help me and thers
interview question plz help me and thers  A college is good if it satisfies the following conditions: 1.Its number of students is greater than 1000. 2.If the name ends wih a character 'e', then it should not start with character
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out  sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out.I want to have a through knowledge
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff... INDICA" and "TATA NANO" respectively. Plz mail me your answers
plz help me to write a snake game using swings - Swing AWT
plz help me to write a snake game using swings  write snake game program using swings
need the answer vry urgently..plz help me...[plzzzzzzzz
need the answer vry urgently..plz help me...[plzzzzzzzz  the question... code...hpw to write in eclipse platform....plz plz mail me...to [email protected]/[email protected]...plz plz...help....me..it can change my lyfe
java coding help plz ?
java coding help plz ?  Given two integers N and M (N ââ?°Â¤ M), output all the prime numbers between N and M inclusive, one per line. N and M will be positive integers less than or equal to 1,000,000,000. The difference
help me plz:-Merge multiple jasper files into Single one
help me plz:-Merge multiple jasper files into Single one  how to Merge multiple jasper files into Single one word doc
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
help me for java coding i will grateful..   i want to convert a image file to its byte code format that help me for the pattern matching in my... help me
plz help - Java Beginners
plz help  i have to programs and it takes too long to run them so i... Thread in java : First Code : import java.io.PrintWriter; import......."); } } For more information on Thread in Java visit to : http
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating a program that will be used to manipulate a student database. This portion of the database will keep track of student data to include the students name(first
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
population problem plz help me befor 16 March 2011 !!
population problem plz help me befor 16 March 2011 !!  the Q is : How can i count how many years it will take for the population of a town to go over 30.000 .. consider that it Increases 10% every year ?? And this is my code &
sir i,have a assignment for these question plz help me sir - JavaMail
sir i,have a assignment for these question plz help me sir   1.Design a Java interface for ADT Stack. Develop two different classes... class hierarchy in Java. Write a test program to demonstrate polymorphism  
help plz - Java Interview Questions
, if the input string is abcd, the output is : edcba plz plz plz plz plz help me   Hi Friend, Try the following: 1) import java.util....help plz  1 )write a program that does the following : a. prompts
Plz provide me all the material for Java
Plz provide me all the material for Java  Plz provide me all the material for Java   Please go through the following link: Java Tutorials
plz help me any one as fast as u can
plz help me any one as fast as u can  A thief Muthhooswamy planned to escape from **** jail. Muthhooswamy is basically a monkey man and he is able to jump across the wall. He practiced to cross a wall and he is able to jump 'X

Ads