Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA Please Write program for exercises You will write a Graphical User Interfac

ID: 3685570 • Letter: J

Question

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 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.

5. Reports. Allows the user to enter year and course. Display the list all students along with their grades.

Explanation / Answer

import java.util.Scanner;

public class Student
{
private String Name;
private String SID;
private String Semester;
private String CID;
private String Year;
private String Grade;
private String month, day, year;

public Student()
{
Name = "Anonymous";
SID = " ";
Semester = "Anonymous";
CID = "xxxx-xxxx";
Grade = "X%"";
}

public void setNames(String name)
{
String[] nameSplit = name.split(" ");
fName = nameSplit[0];
lName = nameSplit[nameSplit.length - 1];
if (nameSplit[1] != lName)
{
mName = nameSplit[1];

}
}
public void setCID(String id)
{
int numbers = 0;
for(int i=0; i<4; i++)
{
if (Character.isDigit(id.charAt(i)))
numbers++;
}
for(int i=5; i<9; i++)
{
if (Character.isDigit(id.charAt(i)))
numbers++;
}
char hyphen = id.charAt(4);
if (id.length() == 9 && hyphen == '-' && numbers == 8) {
UFID = id;
System.out.println("Valid");
}
else
{
System.out.println("UFID is not valid. ");
}
}
public void setYear(String Year)
{
char[] YearChars = Year.toCharArray();

if (((YearChars[1] == '/') && (YearChars[3] == '/' || YearChars[4] == '/')) ||
056
((YearChars[2] == '/') && (YearChars[4] == '/' || YearChars[5] == '/')))
{
String[] YearSplit = Year.split("/");
month = YearSplit[0];
day = YearSplit[1];
year = YearSplit[2];
if (validate(month, day, year))
{
System.out.println("Valid date of birth.");
Year = year;
{
else
{
System.out.println("Invalid Year.");
}
}
else
{
System.out.println("Invalid date format.");
}
}
public static boolean validate(String month, String day, String year)
{
int year_ = Integer.parseInt(year);
if (day.equals("31") &&
(month.equals("4") || month.equals("6") || month.equals("9") ||
month.equals("11") || month.equals("04") || month.equals("06") ||
month.equals("09")))
{
return false; // only 1,3,5,7,8,10,12 has 31 days
}
else if (month.equals("2") || month.equals("02"))

{
if((year_ % 4==0 && year_ % 100!=0) || (year_ % 400==0))

{
if(day.equals("30") || day.equals("31"))

{
return false;
}
else
{
return true;
}
}
else
{
if(day.equals("29")||day.equals("30")||day.equals("31")){
return false;
}
else
{
return true;
}
}
}
else
{   
return true;
}
}
public String getFullName()
{
String fullName;
if (mName.matches(""))
{
fullName = fName + " " + lName;
}
else
{
fullName = fName + " " + mName + " " + lName;
}
return fullName;

}
public String getGrade()
{
return Grade;

}
public String getCID()
{

return CID;

}
public String toString()
{

return "Name: " + SID + ", " + Semester + " CID: " + CID + " D.O.B.: " + Grade;

}

}