Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README_1.md
Original file line number Diff line number Diff line change
@@ -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



Binary file removed bin/App.class
Binary file not shown.
Binary file added bin/Attendance_Grade_System.class
Binary file not shown.
5 changes: 0 additions & 5 deletions src/App.java

This file was deleted.

Binary file added src/Attendance_Grade_System.class
Binary file not shown.
72 changes: 72 additions & 0 deletions src/Attendance_Grade_System.java
Original file line number Diff line number Diff line change
@@ -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.");
}
}
}
1 change: 1 addition & 0 deletions src/tempCodeRunnerFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Excuse_Student