diff --git a/README.md b/README.md index 44d667f..b645a55 100644 --- a/README.md +++ b/README.md @@ -1,142 +1,39 @@ -# Level 1.4: Attendance with Grade System (Java) - -## Table of Contents - -- [Overview](#overview) -- [Learning Objectives](#learning-objectives) -- [Setup and Tutorial](#setup-and-tutorial) -- [Project Overview](#project-overview) -- [Submission Guidelines](#submission-guidelines) - - - -## overview - -This Java program manages attendance and grades for students across multiple subjects. It calculates whether a student passes or fails based on attendance and grade criteria. Additionally, it incorporates an option for an excuse of absence, affecting the attendance record. - -## learning-objectives - -1.Object-Oriented Programming (OOP): Practice creating classes and objects to model real-world entities. - -2.Conditional Statements: Learn how to use conditional statements to make decisions based on specified criteria. - -3.User Input Handling: Utilize the Scanner class to handle user input for attendance, grades, and excuses of absence. - -4.Looping Constructs: Implement loops to allow repeated operations until a termination condition is met. - -5.Algorithmic Thinking: Develop an algorithm to calculate average attendance and determine student success or failure. - -6.Documentation and Sharing: Document code with comments and create a README.md file to provide instructions and project overview. - - -## setup-and-tutorial - -### 1. Setup - -#### 1.1 Java Development Kit (JDK) - -Make sure you have Java Development Kit (JDK) installed on your system. You can download and install JDK from the official Oracle website: [Java SE Downloads](https://www.oracle.com/java/technologies/javase-downloads.html) - -#### 1.2 Integrated Development Environment (IDE) - -Choose an Integrated Development Environment (IDE) for Java development. Some popular options include: -- [visual studio code](https://code.visualstudio.com) -- [IntelliJ IDEA](https://www.jetbrains.com/idea/) - -Download and install the IDE of your choice. - -### 2. Tutorial - -#### 2.1 Java Basics - -If you're new to Java programming, it's essential to understand the basics of the language. Key topics to cover include: -- Syntax: variables, data types, operators, etc. -- Input/output using `System.out.println` and `Scanner` class. -- Control flow statements: if-else, switch-case, loops. - -#### 2.2 Attendance with Grade System Algorithm - -Before coding, plan the algorithm for managing attendance and grades: -- Prompt the user to input attendance for each subject and an excuse of absence if applicable. -- Calculate average attendance across subjects. -- Prompt the user to input grades for the semester. -- Determine whether the student passes or fails based on attendance and grade criteria. - -#### 2.3 Coding the Attendance with Grade System - -Start coding the Attendance with Grade System project: -- Create a Student class to represent student information, including attendance, grades, and methods for calculating success or failure. -- Implement the main application logic to handle user interactions, input, and output. -- Utilize conditional statements and looping constructs to manage attendance, grades, and determining student success or failure. -- Test the program with various inputs to ensure correctness and handle edge cases. - - -#### 2.4 Documentation and Sharing - -Document your code with comments to explain functionality and logic. Create a README.md file to provide project instructions and overview. Share your project with the programming club for feedback and collaboration. - - -## Project Overview: - -### Description - -This Java project focuses on creating an Attendance with Grade System program to manage student attendance and grades for multiple subjects. The program allows users to input attendance, grades, and excuses of absence, and determines whether students pass or fail based on specified criteria. - -### Requirements - -1. **Attendance Tracking:** - - Track attendance for each subject (math, physics, chemistry, programming) with specified requirements. - - Allow users to input an excuse of absence, increasing absences if the excuse contains the word "hospital". - -2. **Grade Input:** - - Prompt users to input grades for the semester (out of 5). - -3. **Success/Failure Determination:** - - Calculate attendance across subjects and determine if it meets the minimum requirement. - - Determine if the grade is above 3.5 (student success), below 3.5, or 3.5 (student failure). - -4. **User Interaction:** - - Implement a user-friendly interface to input attendance, grades, and excuses for absence. - - Provide clear output indicating whether the student passes or fails. -5. **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 -6. **excuse for absence** - add to the program the option of the excuse of absence if the input contains the word hospital increases one absence from each class. - -### Example Interaction -```Welcome to the Attendance and Grade System! -Enter student name: John Doe -Enter the attendance for each subject: -Math: 43 -Physics: 41 -Chemistry: 39 -Programming: 46 -Mark attendance for each subject (Enter excuse of absence): Went to hospital for a check-up -Enter grade for the semester (out of 5): 4.2 - -Student Information: -Name: John Doe -Math Attendance: 44 days -Physics Attendance: 42 days -Chemistry Attendance: 40 days -Programming Attendance: 47 days -Grade: 4.2 - -Result: Success -``` - -### Bonus - -- Implement file I/O to read student information from a file and store results. -- Enhance the user interface with ASCII art or additional messages for better engagement. - -## Submission Guidelines - -- The app should be pushed to Github and a pull request should be created. You can check how to push your code to Github in section [2.1.2 Add Changes](https://github.com/Programming-Club-IAU/git-and-github#212-add-changes). -- The pull request title should be in the following format: ` - `. You can check how to make a pull request in section [2.1.5. Create a pull request](ttps://github.com/Programming-Club-IAU/git-and-github#215-create-a-pull-request). -- The pull request description should contain the following: - - A description of your project. - - A screenshot of the app. +# STUDENT SYSTEM READ ME FILE +________________________________________________________________________________________________________________________________ +# PROJECT BRIFE INFORMATION + +The Student System is a Project That Helps Students or Any User to Check Wheather They Are Successful or Failed from Student's +Informations. The Informations are Student's name, and Attendence in the Four Courses (Math, Physics, Chemistry, and Programming). +As Well as Students Exceuse Incase of Student Abcence to Incerse it Attendence Day by One and it Grade out of 5.0. If The Student +Filfulled it Requirement, It will Display Student's Information with "Success" Message. Otherwise, It will Display the same +Information with a "Fail" Message. +_________________________________________________________________________________________________________________________________ +# THE STUDENT CLASS CONTENT + +The Student Class Contain Numerus of Mehods with Constructor and Many Data Fields, and List Methods with Thier Purposes: +- pas(grade) : Decide which Message to Display After Checking the Requirements. +- display() : Display All Student's Information and it Message. +- mathChecker(math attendence) : Checks if the Math Attencdence Isn't Out of the Range (0 - 50). +- physChecker(physics attendence) : Checks if the Physics Attendence Isn't Out of the Range (0 - 50). +- chemChecker(chemistry attendence) : Checks if the Chemistry Attendence Isn't Out of the Range (0 - 50). +- progChecker(programming attendence) : Checks if the Programming Attendence Isn't Out of the Range (0 - 50). +- gradeChecker(grade) : Checks if the Grade Isn't Out of the Range (0.0 - 5.0). +- excChecker(excuse) : To Checks if the Student Entered an Excuse to Increase it Attendence or not. +- nameChecker(name) : To Check if the Student Entered it Name proply and Didn't enter any Number or Characters in their Name by +the ASCII. +_________________________________________________________________________________________________________________________________ +# MAIN CLASS CONTENT AND FLOW CONTROL + +The Class May Contains the InputMismatch excpetion class imported to face input issue esspesally to the attendence input, and a +Scanner Class for being able to have inputs take from the user. There are two object created to implement the classes Scanner and +Student class, with a user-friendly interface. Afterward, in each input that will be asked from the user-interface will be checked +by it method , and if the checking is done successfully with any issues it will be taken to the Student class as data feild intialz. +Once all the data are inmported it will display all the information and disply a message that the system has finally processed +everything. if there is any wrong input the system will stop the process ,and display an error message or an wrong input cuase it to +stop. +_________________________________________________________________________________________________________________________________ +# NOTES + +- all of the requirment are filfulled. +- there isn't any ASCII characters are used to advance to the next level. +- most of the error encounter are fixed and won't cause any problems to the program. \ No newline at end of file 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/lib/junit-platform-console-standalone-1.10.2.jar b/lib/junit-platform-console-standalone-1.10.2.jar new file mode 100644 index 0000000..7ca10e6 Binary files /dev/null and b/lib/junit-platform-console-standalone-1.10.2.jar differ diff --git a/src/App.class b/src/App.class new file mode 100644 index 0000000..f196fde Binary files /dev/null and b/src/App.class differ diff --git a/src/App.java b/src/App.java index 0a839f9..c920f93 100644 --- a/src/App.java +++ b/src/App.java @@ -1,5 +1,61 @@ +import java.util.Scanner; +import java.util.InputMismatchException; public class App { - public static void main(String[] args) throws Exception { - System.out.println("Hello, World!"); + public static void main(String[] args) { + //importing the class + Scanner input=new Scanner(System.in); + Student info = new Student(); + + try{ + //the friendly user interface with the inputs with checking every input with the proper cheacker and inporting every infomation to the class "Student" + System.out.print("=========================================================================\n Welcome to The Attendence and Grading System \n Enter The Student name: "); + String name=input.nextLine(); + info.nameChecker(name); + info.name=name; + + System.out.print("Enter The Attendence for Each of These Subjects IN ORDER (Math, Physics, Chemistry, Programming)\n>"); + int math=input.nextInt(); + info.mathChecker(math); + info.AttMath=math; + + System.out.print(">"); + int physics=input.nextInt(); + info.physChecker(physics); + info.AttPhysics=physics; + + System.out.print(">"); + int chemistry=input.nextInt(); + info.chemChecker(chemistry); + info.AttChemistry=chemistry; + + System.out.print(">"); + int programming=input.nextInt(); + info.progChecker(programming); + info.AttProgramming=programming; + + //for the buffuring issue, added a next new line input + input.nextLine(); + + System.out.print("Mark attendance for each subject (enter excuse fo absence): "); + String excusse=input.nextLine(); + info.excChecker(excusse); + info.excuse=excusse; + + System.out.print("Enter grade for the semester (out of 5): "); + double grade=input.nextDouble(); + info.gradeChecker(grade); + info.grade=grade; + + //Checking if the Student pass or not and display it infomation + info.pas(grade); + info.display(); + + }catch(InputMismatchException e){ + System.err.println("Error:\nWrong Inputs ,Try Again"); + } finally{ + System.out.println("========================================================="); + System.out.println("\tThe Student System Excecuted Successfully"); + } + } } diff --git a/src/Student.class b/src/Student.class new file mode 100644 index 0000000..d5a9d82 Binary files /dev/null and b/src/Student.class differ diff --git a/src/Student.java b/src/Student.java new file mode 100644 index 0000000..0b4a917 --- /dev/null +++ b/src/Student.java @@ -0,0 +1,97 @@ +class Student { + String name; + double grade; + int AttMath; + int AttPhysics; + int AttChemistry; + int AttProgramming; + String excuse; + + Student(){ + this.name="null"; + this.grade=0.0; + this.AttMath=0; + this.AttPhysics=0; + this.AttChemistry=0; + this.AttProgramming=0; + } + + Student(String name,double grade, int AttMath, int AttPhysics, int AttChemistry, int AttProgramming){ + this.name=name; + this.AttMath=AttMath; + this.AttPhysics=AttPhysics; + this.AttChemistry=AttChemistry; + this.AttProgramming=AttProgramming; + } + + public String pas(double grade){ + if (grade>=3.5 && AttMath>=44 && AttPhysics>=42 && AttChemistry>=40 && AttProgramming>=47){ + return "Success"; + }else + return "Fail"; + } + + public void display(){ + System.out.println("\nStudent information:\nName: "+name+"\nMath Attendance: "+AttMath+" days\nPhysics Attendance: "+AttPhysics+" days\nChemistry Attendance: "+AttChemistry+" days\nProgramming Attendance: "+AttProgramming+" days\nGrade: "+grade); + System.out.println("\nThe Results: "+pas(grade)); + } + + public void mathChecker(int AttMath){ + if(AttMath<0 || AttMath>50){ + System.err.println("The Math Attendence is Incorrect, Please Enter Again."); + System.exit(0); + } + } + + public void physChecker(int AttPhysics){ + if(AttPhysics<0 || AttPhysics>50){ + System.err.println("The Physics Attendence is Incorrect, Please Enter Again."); + System.exit(0); + } + } + + public void chemChecker(int AttChemistry){ + if(AttChemistry<0 || AttChemistry>50){ + System.err.println("The Chemistry Attendence is Incorrect, Please Enter Again."); + System.exit(0); + } + } + + public void progChecker(int AttProgramming){ + if(AttProgramming<0 || AttProgramming>50){ + System.err.println("The Programming Attendence is Incorrect, Please Enter Again."); + System.exit(0); + } + } + + public void gradeChecker(double grade){ + if(grade<0.0 || grade>5.0){ + System.err.println("The Grade is Incorrect, Please Enter Again."); + System.exit(0); + } + } + + public void excChecker(String excuse) { + String[] words = excuse.split(" "); + for (String word : words) { + if (word.equals("hospital")) { + AttMath++; + AttPhysics++; + AttChemistry++; + AttProgramming++; + break; + } + } + } + + public void nameChecker(String name){ + for(int i=0 ; i64 && name.charAt(i)<91) || (name.charAt(i)>96 && name.charAt(i)<123)){ + }else { + System.err.println("The Name is Incorrect, Please Enter Again"); + System.exit(0); + } + } + + } +}