diff --git a/README_1.md b/README_1.md new file mode 100644 index 0000000..75cca69 --- /dev/null +++ b/README_1.md @@ -0,0 +1,42 @@ +# Level 1.4: Attendance with Grade System (Java) + + +## comments + +**For absence** + If you have an excuse for absence, enter "hospital” and a day of absence will be added to you. + +**Subjects** + Which is counted as absence + (math, physics, chemistry, programming). + +**minimum attendance day** + - math classes should be attended 44 days out of 50 + - physics classes should be attended 42 days out of 50 + - chemistry classes should be attended 40 days out of 50 + - programming classes should be attended 47 days out of 50 + +**success** + You must meet the following conditions: + 1- Do not be absent more than permitted + 2- Cumulative GPA above 3.5 + +## Some things we will use inside the code + +**input/output** + 1- input : + We use Scanner + ( import java.util.Scanner; ) + 2- output : + System.out.print(); + +**If and for** + We use the condition function `IF` to determine success and failure or whether there is an excuse or not + + We use the iteration function `For` to insert and output values from presence + +**ASCII** + I put the university abbreviation `IAU` to give it a better appearance + + + diff --git a/bin/App.class b/bin/App.class deleted file mode 100644 index baa6c67..0000000 Binary files a/bin/App.class and /dev/null differ diff --git a/bin/Attendance_Grade_System.class b/bin/Attendance_Grade_System.class new file mode 100644 index 0000000..02f70df Binary files /dev/null and b/bin/Attendance_Grade_System.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/Attendance_Grade_System.class b/src/Attendance_Grade_System.class new file mode 100644 index 0000000..666ba50 Binary files /dev/null and b/src/Attendance_Grade_System.class differ diff --git a/src/Attendance_Grade_System.java b/src/Attendance_Grade_System.java new file mode 100644 index 0000000..b931794 --- /dev/null +++ b/src/Attendance_Grade_System.java @@ -0,0 +1,72 @@ +import java.util.Scanner ; + +public class Attendance_Grade_System { + public static void main(String[] args) throws Exception { + Scanner scanner = new Scanner(System.in); + + String iauArt = + " III A U U \n" + + " I A A U U \n" + + " I AAAAA U U \n" + + " I A A U U \n" + + " III A A UUU \n"; + System.out.println(iauArt); + System.out.println("===========================================================================\n\n"); + System.out.print( + "Welcome to the Attendance with Grade System\n\n"+ + "Enter student name: "); + String student_name = scanner.nextLine(); + + int requirement_attendance[] = {44 , 42 , 40 , 47} ; + int attendance[] = new int[4] ; + String[] subjects = {"Math" , "Physics" , "Chemistry" , "Programming"}; + boolean hospitalExcuse = false; + + System.out.println("Enter the attendance for each subject: "); + for (int i = 0 ; i < attendance.length ; i++){ + System.out.print(subjects[i] + ": "); + attendance[i] = scanner.nextInt(); + } + System.out.println("===========================================================================\n\n"); + System.out.println("Mark attendance for each subject (Enter excuse of absence): "); + scanner.nextLine(); + String excuse = scanner.nextLine(); + if (excuse.toLowerCase().contains("hospital")) { + hospitalExcuse = true; + } + + if (hospitalExcuse){ + for ( int i = 0 ; i < attendance.length ; i++ ){ + attendance[i]++ ; + } + } + System.out.println("===========================================================================\n\n"); + System.out.println("Enter grade for the semester (out of 5):"); + double grade = scanner.nextDouble(); + + boolean success = true ; + for (int i = 0 ; i < requirement_attendance.length;i++){ + if ( attendance[i] < requirement_attendance[i] ) { + success = false; + break; + } + } + if (grade < 3.5){ + success = false; + } + System.out.println("===========================================================================\n\n"); + System.out.println("Student Information: "); + System.out.println("Name: "+student_name); + for (int i = 0 ; i < attendance.length ; i++){ + System.out.println(subjects[i] + + "Attendance: " + attendance[i] + " days." ); + } + System.out.println("Grade: " + grade + "\n"); + if (success){ + System.out.println("Result: Success."); + } + else{ + System.out.println("Result: failure."); + } + } +} diff --git a/src/tempCodeRunnerFile.java b/src/tempCodeRunnerFile.java new file mode 100644 index 0000000..0b23c42 --- /dev/null +++ b/src/tempCodeRunnerFile.java @@ -0,0 +1 @@ +Excuse_Student \ No newline at end of file