Please write the code in java Assignment Coding the Student

Please write the code in java.

Assignment: Coding the Student Profile Program

The assignment is to implement the Student Profile Program following the “requirements” listed in the Specification section below. The goal of this assignment is to write this application as “tight” as possible, meaning without run-time or logical errors.
The application must compile for credit to be received.

Specification:

The Student Profile Program logs student information to an external file. The system must allow for the entry of multiple students. The information that is recorded for each student in the log is the following:
1. Full name

2. Age
3. TUID Number
4. Email Address
5. Phone Number
6. Major
7. Expected graduation date
8. Is the student an Undergraduate?

The Application is to have a simple user interface that allows the user to input the following and only the following:
1. Last Name
2. First Name

3. Middle Name
4. Date of Birth
5. Phone Number
6. Expected Graduation Date 7. TUID

8. Email Address
9. Major
10. Whether the student is an undergraduate or not.

Student data will be written to an external file in a presentable manner. Simply listing each student’s information separated by a blank line between students is acceptable.
The application does not have to allow for editing of student information once it has been submitted.

Solution

This is the code for the Student class.


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

class StudentFrame extends Frame implements ActionListener
{
String msg=\"\";
Button btnNew,btnSubmit,btnView;
Label lblName,lblAge,lblemailAddr,lblphoneNo,lblMajor,lblTUID,lblUndergrad;
TextField txtName,txtAge,txtMajor,txtphoneNo,txtTUID;
TextArea txtemailAddr;
CheckboxGroup ChkGrp;
Checkbox chkYes,chkNo;


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

lblName = new Label(\"Name: \");
lblAge = new Label(\"Age: \");
lblemailAddr = new Label(\"EmailAddress : \");
lblphoneNo = new Label(\"PhoneNo: \");
lblTUID=new Label(\"TUID NO:\");
lblMajor = new Label(\"Major: \");
lblUndergrad=new Label(\"Undergrad:\");
txtName = new TextField(20);
txtAge = new TextField(20);
txtemailAddr = new TextArea();
txtMajor = new TextField(20);
txtphoneNo = new TextField(20);
txtTUID=new TextField(20);
  
ChkGrp = new CheckboxGroup();
chkYes = new Checkbox(\"Yes\",ChkGrp,false);
chkNo = new Checkbox(\"No\",ChkGrp,false);
btnNew = new Button(\"NEW\");
btnSubmit = new Button(\"SUBMIT\");
  
  
btnNew.addActionListener(this);
btnSubmit.addActionListener(this);

add(lblName);
add(txtName);
add(lblAge);
add(txtAge);
add(lblemailAddr);
add(txtemailAddr);
add(lblphoneNo);
add(txtphoneNo);
add(lblMajor);
add(txtMajor);
add(lblUndergrad);
add(chkYes);
add(chkNo);
  
  
add(btnNew);
add(btnSubmit);
  
  

  
}
  
public void actionPerformed(ActionEvent ae)
{
String s=\"\";
boolean b;
FileInputStream Fin;
  
FileOutputStream Fout;
  
String name,email,major,phoneno,age,TUID,undergrad;
try
{
Fout = new FileOutputStream(\"studentinfo.txt\",true);
String str = ae.getActionCommand();
if(str.equals(\"SUBMIT\"))
{
  
name=txtName.getText().trim();
email=txtemailAddr.getText();
age=txtAge.getText();
major=txtMajor.getText();
phoneno=txtphoneNo.getText();
TUID=txtTUID.getText();
if(chkYes.getState())undergrad=\"Yes\";
else undergrad=\"No\";
  
s=name+\" \"+age+\" \"+email+\" \"+major+\" \"+phoneno+\" \"+TUID+\" \"+undergrad+\"\ \"+\"\ \";
  
Fout.write(s.getBytes());
Fout.close();
}
  
  

if(str.equals(\"NEW\"))
{
txtName.setText(\"\");
txtAge.setText(\"\");
txtemailAddr.setText(\"\");
txtphoneNo.setText(\"\");
txtTUID.setText(\"\");
txtMajor.setText(\"\");
chkYes.setState(false);
chkNo.setState(false);
  
  
}
}
catch(Exception e)
{
System.out.println(\"The Exception Is : \" +e);
}

}

}

class Student
{

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

}

Please write the code in java. Assignment: Coding the Student Profile Program The assignment is to implement the Student Profile Program following the “requirem
Please write the code in java. Assignment: Coding the Student Profile Program The assignment is to implement the Student Profile Program following the “requirem
Please write the code in java. Assignment: Coding the Student Profile Program The assignment is to implement the Student Profile Program following the “requirem

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site