Question
the GUI of the Student Grading Systems for Class Student is developed, and these forms are added to the menu. In this assignment, you will
the GUI of the Student Grading Systems for Class Student is developed, and these forms are added to the menu.
In this assignment, you will develop the GUI forms for all classes of your own term project topic
package studentgradingsystem;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.JOptionPane;
/**
*
* @author Cem Yagli
*/
public class StudentGradingSystem {
public static List students, grades, departments, courses, attendance;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
students = new ArrayList();
grades = new ArrayList();
departments = new ArrayList();
courses = new ArrayList();
attendance = new ArrayList();
test_students();
System.out.printf(" ");
}
public static void test_students() {
try {
System.out.printf(" Tests for Class Student ");
System.out.printf(" Add_student() ");
add_student(1, "116229", "Ali Huseyin", "Faisal", "Male", "Turkey", "19/06/1993");
add_student(2, "186731", "Ayse", "Kemaller", "Female", "Cyprus", "28/09/1998");
add_student(3, "168337", "Muhammad", "Fahrad", "Male", "Iran", "30/05/1996");
add_student(4, "189222", "Fatima", "Reshad", "Female", "Syria", "22/07/1998");
add_student(5, "199221", "Bahar", "Tunc", "Female", "Cyprus", "27/08/2019");
System.out.printf(" List_student() ");
list_students();
System.out.printf(" Edit_student() ");
edit_student(2, "186731", "Ayse", "Kemaller", "Female", "Turkey", "28/09/1998");
System.out.printf(" List_student() ");
list_students();
backup_student();
System.out.printf(" Delete_student(4) ");
delete_student(4);
System.out.printf(" List_student() ");
list_students();
retrieve_student();
System.out.printf(" List_student() ");
list_students();
}
catch (IOException | ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, "Error");
}
}
public static void retrieve_student() throws IOException, ClassNotFoundException
{
File infile = new File("students.dat");
FileInputStream infilestream = new FileInputStream(infile);
ObjectInputStream inObjectStream = new ObjectInputStream(infilestream);
students = (ArrayList)inObjectStream.readObject();
inObjectStream.close();
}
public static void backup_student() throws IOException
{
File outfile = new File("students.dat");
FileOutputStream outfilestream = new FileOutputStream(outfile);
ObjectOutputStream outObjectStream = new ObjectOutputStream(outfilestream);
outObjectStream.writeObject(students);
outObjectStream.close();
}
public static void add_student(int std_id, String std_no, String std_name, String std_surname,
String gender, String nationality, String birthday) {
Student st =new Student(std_id, std_no, std_name, std_surname,
gender, nationality, birthday);
students.add(st);
}
public static void edit_student(int std_id, String std_no, String std_name,
String std_surname, String gender,
String nationality, String birthday) {
Student st=null;
Boolean found=false;
Iterator
while (itr.hasNext()) {
st = itr.next();
if(std_id==st.getStd_id()) {
found=true;
break;
}
}
if (found) {
st.setStd_no(std_no);
st.setStd_name(std_name);
st.setStd_surname(std_surname);
st.setNationality(nationality);
st.setGender(gender);
st.setBirthday(birthday);
}
}
public static void delete_student(int std_id) {
Student st=null;
Boolean found=false;
Iterator
while (itr.hasNext()) {
st = itr.next();
if(std_id==(st.getStd_id())) {
found=true;
break;
}
}
if (found) students.remove(st);
}
public static void draw_line(int num) {
String ln="";
for (int i=0; i System.out.printf(" "+ln); } public static void list_students() { Student st; Iterator System.out.printf(" %2s %10s %15s %15s %10s %12s %12s", "Id", "Student No","Std. Name", "Std. Surname", "Gender","Nationality", "Birthday"); draw_line(79); while (itr.hasNext()) { st = itr.next(); System.out.printf(" %2d %10s %15s %15s %10s %12s %12s", st.getStd_id(), st.getStd_no(), st.getStd_name(), st.getStd_surname(), st.getGender(), st.getNationality(), st.getBirthday()); } draw_line(79); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started