diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..6f29fee
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..408d14d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Level-1.4.iml b/Level-1.4.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/Level-1.4.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/Level-1.4/Main.class b/out/production/Level-1.4/Main.class
new file mode 100644
index 0000000..12020f6
Binary files /dev/null and b/out/production/Level-1.4/Main.class differ
diff --git a/out/production/Level-1.4/Student.class b/out/production/Level-1.4/Student.class
new file mode 100644
index 0000000..0830aa0
Binary files /dev/null and b/out/production/Level-1.4/Student.class differ
diff --git a/out/production/Level-1.4/StudentFrame.class b/out/production/Level-1.4/StudentFrame.class
new file mode 100644
index 0000000..b4d602e
Binary files /dev/null and b/out/production/Level-1.4/StudentFrame.class differ
diff --git a/src/App.java b/src/App.java
deleted file mode 100644
index 0a839f9..0000000
--- a/src/App.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class App {
- public static void main(String[] args) throws Exception {
- System.out.println("Hello, World!");
- }
-}
diff --git a/src/Main.java b/src/Main.java
new file mode 100644
index 0000000..6f36355
--- /dev/null
+++ b/src/Main.java
@@ -0,0 +1,148 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.InputMismatchException;
+import java.util.Scanner;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.io.FileNotFoundException;
+public class Main{
+ static ArrayList studentList;
+ public static void main(String[] args) throws FileNotFoundException {
+ studentList = initialize();
+ Scanner input = new Scanner(System.in);
+ boolean flag = true;
+
+ do{
+ try{
+ System.out.print("""
+ Please select one of the following operations:
+ 1- Add a new student
+ 2- View student info in records
+ 3- Exit program
+ """);
+
+ short choice = input.nextShort();
+
+ switch( choice ){
+ case 1:
+ int id;
+ String fName, lName;
+ System.out.print("Please insert ID: ");
+ id = input.nextInt();
+ if(find(id) != -1)
+ throw new IllegalArgumentException("ID already exists!");
+
+ System.out.print("Please insert first name: ");
+ fName = input.next();
+ System.out.print("Please insert last name: ");
+ lName = input.next();
+
+ Student temp = new Student(id, fName, lName);
+ System.out.println("Please insert the amount of absences in the following subjects (out of 50):");
+ for(short i = 0; i < 4; i++){
+ String[] courseList = {"Math", "Phys", "Chem", "Comp"};
+ short attendanceNum;
+ System.out.printf("%s: ", courseList[i]);
+ attendanceNum = input.nextShort();
+ temp.setAttendance(attendanceNum, i);
+ }
+
+ System.out.print("Any excused absences? (y/n): ");
+ if(input.next().toLowerCase().charAt(0) == 'y'){
+ input.nextLine();
+ System.out.print("Please insert ALL excuses here: ");
+ Scanner reader = new Scanner(input.nextLine());
+ while(reader.hasNext())
+ if( reader.next().equalsIgnoreCase("hospital"))
+ temp.attendanceIncrease();
+ reader.close();
+ }
+ else input.nextLine();
+
+ System.out.print("Please insert grade (0.0 - 5.0): ");
+ temp.setGpa(input.nextDouble());
+
+
+ view(temp);
+ studentList.add(temp);
+ break;
+
+ case 2:
+ int index;
+ System.out.print("Please insert student ID here: ");
+ index = find(input.nextInt());
+ if(index == -1)
+ throw new IllegalArgumentException("ID not in records!");
+ view(studentList.get(index));
+ break;
+
+ case 3:
+ flag = false;
+
+
+ }
+ }
+ catch(InputMismatchException e){
+ System.err.println("Wrong type of input!");
+ input.nextLine();
+ }
+ catch (IllegalArgumentException f){
+ System.err.println(f.getMessage());
+ }
+ finally {
+ System.out.println("-----------------------------------------------------------------------------\n");
+ }
+ }
+ while(flag);
+
+
+
+
+
+
+
+ save();
+ }
+
+ static ArrayList initialize(){
+ ArrayList temp = new ArrayList<>();
+ try{
+ Scanner reader = new Scanner( new FileInputStream("studentList.txt"));
+ while(reader.hasNext() ) {
+ temp.add(new Student(reader.nextInt(), reader.next(), reader.next()));
+ for (short i = 0; i < 4; i++)
+ temp.getLast().setAttendance(reader.nextShort(), i);
+ temp.getLast().setGpa(reader.nextDouble());
+ }
+ }
+ catch(FileNotFoundException e){
+ new File("studentList.txt");
+ return new ArrayList<>();
+ }
+ return temp;
+ }
+
+ static void save() throws FileNotFoundException {
+ PrintWriter pout = new PrintWriter(new FileOutputStream("studentList.txt"));
+ for(Student i : studentList ) {
+ pout.print(String.format("%d\t%s\t", i.getID(), i.getName()));
+ for(short j : i.getAttendanceList())
+ pout.print(j + "\t");
+ pout.println(i.getGPA());
+ }
+ pout.close();
+ }
+
+ static int find(int id){
+ for(int i = 0; i < studentList.size(); i++)
+ if(id == studentList.get(i).getID())
+ return i;
+ return -1;
+ }
+
+ static void view(Student std){
+ System.out.printf("-----------------------------------------------------------------------------\nID: %d\nName: %s\nATTENDANCE [MATH, PHYS, CHEM, COMP]:\n%s\nGPA: %.2f\n\n%s\n",std.getID(),std.getName(), Arrays.toString(std.getAttendanceList()), std.getGPA(),std.getStatus());
+ }
+}
\ No newline at end of file
diff --git a/src/Student.java b/src/Student.java
new file mode 100644
index 0000000..cb25442
--- /dev/null
+++ b/src/Student.java
@@ -0,0 +1,59 @@
+public class Student {
+ private final int ID;
+ private final String NAME;
+ private double gpa;
+
+
+
+ //Math: 0 Phys: 1 Chem: 2 Prog: 3
+ private static final short attendanceLimit[] = {44,42,40,47};
+ private final short[] attendanceList = new short[4];
+
+ public Student(int id, String fName, String lName){
+ ID = id;
+ NAME = String.format("%s\t%s",fName,lName);
+ }
+
+ public int getID(){
+ return ID;
+ }
+
+ public String getName(){
+ return NAME;
+ }
+
+ public double getGPA(){
+ return gpa;
+ }
+
+ public short[] getAttendanceList(){
+ return attendanceList;
+ }
+
+ public void setGpa(double newGrade)throws IllegalArgumentException{
+ if(newGrade > 5 || newGrade < 0)
+ throw new IllegalArgumentException("Inserted grade is not within acceptable range.");
+ else gpa = newGrade;
+ }
+
+ public void setAttendance(short absenceNum, short courseIndex){
+ if(absenceNum > 50 || absenceNum < 0)
+ throw new IllegalArgumentException("Attendance number not within range!");
+ attendanceList[ courseIndex ] = absenceNum;
+ }
+
+ public void attendanceIncrease(){
+ for(short i = 0; i < attendanceList.length; i++)
+ if(attendanceList[i] < 50)
+ setAttendance((short) (attendanceList[i] + 1), i);
+ }
+
+ public String getStatus(){
+ for(short i = 0; i < 4; i++)
+ if(attendanceList[i] < attendanceLimit[i])
+ return "FAIL";
+ if( getGPA() < 3.5)
+ return "FAIL";
+ return "PASS";
+ }
+}
diff --git a/studentList.txt b/studentList.txt
new file mode 100644
index 0000000..5b4a8a4
--- /dev/null
+++ b/studentList.txt
@@ -0,0 +1,2 @@
+310 Super Mario 50 50 50 50 5.0
+935 Edward Richtofen 41 43 41 49 4.5