Question

The application should be in JAVA and allow: 1. Collect student information and store it in...

The application should be in JAVA and allow:

1. Collect student information and store it in a binary data file. Each student is identified by an unique ID. The user should be able to view/edit an existing student. Do not allow the user to edit student ID.

2. Collect Course information and store it in a separate data file. Each course is identified by an unique ID. The user should be able to view/edit an existing course information. User is not allowed to edit the key field such as Course ID.

3. Collect Enrollment information. Here you allow the user to enroll students to courses. You make sure that the user types valid student id and course ID. You display the student and course information in the window. You will have to store enrollment information in a separate binary file. This file may contain the course, student ID, Year and semester information.

4. Grade Management, such as Add grades, View Grades. You will allow the user to enter student ID, year, Semester, course ID, and the grade. The user should be above to view/edit the grades.

You can create a menu driven interface to select the above options.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;

class Frame1 extends Frame implements ActionListener
{
    String msg="";
    Button btnNew,btnSubmit,btnView;
    Label lblName,lblAge,lblAddr,lblGender,lblQua,unique_id,grade;
    TextField txtName,txtAge,txtgrade;
    TextArea txtAddr,txtAns;
    CheckboxGroup ChkGrp;
    Checkbox chkMale,chkFemale;
    Checkbox chkMca,chkBca,chkBba,chkMba;

     Frame1(String name)
    {  
        super(name);
        setLayout(new GridLayout(3,2));

        lblName = new Label("Name: ");
        lblAge = new Label("Age: ");
        lblAddr = new Label("Address : ");
        lblGender = new Label("Gender: ");
        lblQua = new Label("Qualification: ");
        unique_id = new Label("unique_id: ");
        grade = new Label("Grade: ");
        txtName = new TextField(20);
        txtAge = new TextField(20);
        txtAddr = new TextArea();
        txtgrade = new TextArea();
        ChkGrp = new CheckboxGroup();
        chkMale = new Checkbox("Male",ChkGrp,false);
        chkFemale = new Checkbox("Female",ChkGrp,false);
        chkMca = new Checkbox("MCA");
        chkBca = new Checkbox("BCA");
        chkMba = new Checkbox("MBA");
        chkBba = new Checkbox("BBA");
        btnNew = new Button("NEW");
        btnSubmit = new Button("SUBMIT");
        btnView = new Button("VIEW");
      
        btnNew.addActionListener(this);
        btnSubmit.addActionListener(this);
        btnView.addActionListener(this);

        add(lblName);
        add(txtName);
        add(lblAge);
        add(txtAge);
        add(lblAddr);
        add(txtAddr);
        add(unique_id);
        add(grade);
        add(lblGender);
        add(chkMale);
        add(chkFemale);
        add(lblQua);
        add(chkBca);
        add(chkBba);
        add(chkMca);
        add(chkMba);
  
        add(btnNew);
        add(btnSubmit);
        add(btnView);
      
        txtAns = new TextArea();
        add(txtAns);
      
    }  
      
    publicvoid actionPerformed(ActionEvent ae)
    {
        String s="";
        boolean b;
        FileInputStream Fin;
        DataInputStream dis;
        FileOutputStream Fout;
        DataOutputStream dos;
      
        try
        {
            Fout = new FileOutputStream("Biodata.txt",true);
            dos = new DataOutputStream(Fout);
      
            String str = ae.getActionCommand();
            if(str.equals("SUBMIT"))
            {
          
                s=txtName.getText().trim();
                dos.writeUTF(s);
          
                dos.writeInt(Integer.parseInt(txtAge.getText()));

                s=txtAddr.getText();
              
                dos.writeUTF(s);
                if(chkMale.getState())
                    dos.writeUTF("Male ");
                if(chkFemale.getState())
                    dos.writeUTF("Female ");

                s="";                  
                if(chkMca.getState())
                    s="MCA ";  
                              
                if(chkBca.getState())
                    s+="BCA ";                      

                if(chkBba.getState())
                    s+="BBA ";  
                  
                if(chkMba.getState())
                    s+="MBA ";  
                  
                s+="!";
                dos.writeUTF(s);
                Fout.close();
            }
          
            if(str.equals("VIEW"))
            {
                String tmp,name,addr,gender,qual;
                int age;
                Fin = new FileInputStream("Biodata.txt");
                dis = new DataInputStream(Fin);

      
                int i=0,j;
              
                while(Fin.available()>0)
                {
                    name = dis.readUTF();
                    age = dis.readInt();
                    addr = dis.readUTF();
                    gender = dis.readUTF();
                    qual = dis.readUTF();

                    if(name.equals(txtName.getText().trim()))
                      {
                        txtAge.setText(age+"");                  
                        txtAddr.setText(addr);
                        if(gender.equals("Male "))
                            chkMale.setState(true);
                        else
                            chkFemale.setState(true);
                        while(qual.charAt(i)!='!')
                        {
                            j=qual.indexOf(' ');
                            tmp = qual.substring(i,j);
  
                            if(tmp.equals("MCA"))
                                chkMca.setState(true);                  

                            if(tmp.equals("BCA"))
                                chkBca.setState(true);                  

                            if(tmp.equals("BBA"))
                                chkBba.setState(true);                  

                            if(tmp.equals("MBA"))
                                chkMba.setState(true);
                            i=j+1;
                        }
                        break;
                    }
                }
                Fin.close();  
            }

            if(str.equals("NEW"))
            {
                txtName.setText("");
                txtAge.setText("");                  
                txtAddr.setText("");
                txtGrade.setText("");
                chkMale.setState(false);
                chkFemale.setState(false);
                chkMca.setState(false);                  
                chkBca.setState(false);                  
                chkBba.setState(false);                  
                chkMba.setState(false);
            }
        }
        catch(Exception e)
        {
            System.out.println("The Exception Is : " +e);
        }

    }

}

class student
{

    public static void main(String args[])
    {
        try{
        Frame1 F = new Frame1("student");
        F.setSize(400,400);
        F.show();
        }catch(Exception e)
        {
            System.out.println(e);
        }
    }  

}

Add a comment
Know the answer?
Add Answer to:
The application should be in JAVA and allow: 1. Collect student information and store it in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java This application will be menu driven. The application should allow: 1. Collect student information and...

    Java This application will be menu driven. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID.   The user should be able to view/edit an existing student. Do not allow the user to edit student ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique ID. The user should be able to view/edit an existing course...

  • In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student...

    In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student information system. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID. The user should be able to view/edit an existing student. Do not allow student to edit ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique...

  • Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and...

    Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and his/her course names with grades. ? Your system should allow the user to input, update, delete, list and search students’ grades. ? Each student has a name (assuming no students share the same name) and some course/grade pairs. If an existing name detected, user can choose to quit or to add new courses to that student. ? Each student has 1 to 5 courses,...

  • C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to...

    C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to Random Access Binary File. New program should be modified to display a menu for the user to do the following: 1. Replace Employee and Department classes with Employee and Department Structures. 2. Inside each structure, replace all string variables with array of characters. 3. Make Employee and Department editable. That means, the user should be able to edit a given Employee and Department. 4....

  • C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to...

    C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to Random Access Binary File. New program should be modified to display a menu for the user to do the following: 1. Replace Employee and Department classes with Employee and Department Structures. 2. Inside each structure, replace all string variables with array of characters. 3. Make Employee and Department editable. That means, the user should be able to edit a given Employee and Department. 4....

  • Language: C++ Write a program that will allow the instructor to enter the student's names, student...

    Language: C++ Write a program that will allow the instructor to enter the student's names, student ID, and their scores on the various exams and projects. A class has a number of students during a semester. Those students take 4 quizzes, one midterm, and one final project. All quizzes weights add up to 40% of the overall grade. The midterm exam is 25% while the final project 35%. The program will issue a report. The report will show individual grades...

  • python anywhere questions. A Class Management System, Part 2 Please also refer to the description provided...

    python anywhere questions. A Class Management System, Part 2 Please also refer to the description provided in Part 1 of the project “A Class management System”. You have had a chance to state your understanding of the requirements for this project, draft a preliminary design, and express it by means of UML diagrams. Now it’s time to implement your design. As stated in the original requirements, there will be three categories of users: 1. Students 2. Instructors 3. Administrators Recall...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • Book: Systems Analysis and Design in a Changing World, 7th Edition 3. Consider the domain model...

    Book: Systems Analysis and Design in a Changing World, 7th Edition 3. Consider the domain model class diagram shown in Figure 4-16—the refined diagram showing course enrollment with an association class. Does this model allow a student to enroll in more than one course section at a time? Does the model allow a course section to contain more than one student? Does the model allow a student to enroll in several sections of the same course and get a grade...

  • Writing 3 Java Classes for Student registration /** * A class which maintains basic information about...

    Writing 3 Java Classes for Student registration /** * A class which maintains basic information about an academic course. */ public class Course {    /** * Attributes. */ private String code; private String title; private String dept; // name of department offering the course private int credits; /** * Constructor. */ public Course(String code, String title, int credits) { // TODO : initialize instance variables, use the static method defined in // Registrar to initialize the dept name variable...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT