diff --git a/Maryam M. - Level-1.4 b/Maryam M. - Level-1.4 new file mode 100644 index 0000000..6018fec --- /dev/null +++ b/Maryam M. - Level-1.4 @@ -0,0 +1,41 @@ +import java.util.Scanner; +public class HelloWorld { + public static void main(String[] args){ + Scanner sc = new Scanner(System.in); + boolean HE=false; + int[] attendance = new int[4]; + String[] subject = {"Math", "Physics", "Chemistry", "Programming"}; + System.out.print("Enter student name: "); + String name = sc.nextLine(); + for (int i = 0; i < 4; i++) { + System.out.print("Enter the attendance for " + subject[i] + " : "); + attendance[i] = sc.nextInt(); + } + sc.nextLine(); + System.out.print("Enter excuse of absence (HE for Hosbital excuse): "); + String excuse = sc.nextLine(); + if(excuse=="HE" || excuse =="he" || excuse=="He"){ + HE=true;} + else{ + for (int i = 0; i < 4; i++){ + attendance[i]++; + } + } + String result; + System.out.print("Enter grade for the semester (out of 5): "); + double grade = Double.parseDouble(sc.nextLine()); + + if(grade > 3.5 && grade <=5 && attendance[0] > 43 && attendance[1]> 41 && attendance[2]>39 && attendance[3]>46 ) + result = "Succeed"; + else + result = "failed"; + + System.out.println("\nStudent information:"); + for (int i = 0; i < 4; i++) { + System.out.println(subject[i] + " Attendance: " + attendance[i] + " days"); + } + System.out.println("Grade: " + grade); + System.out.println("Result: " + result); + sc.close(); + } +}