From 44b586539163a7f154bef6a7dfbb1726e73f07ba Mon Sep 17 00:00:00 2001 From: "Md. Zunaied Nudar" Date: Wed, 20 Aug 2025 12:38:05 +0600 Subject: [PATCH 1/4] Student.java added --- src/main/java/com/thealgorithms/Student.java | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/java/com/thealgorithms/Student.java diff --git a/src/main/java/com/thealgorithms/Student.java b/src/main/java/com/thealgorithms/Student.java new file mode 100644 index 000000000000..07938aa66560 --- /dev/null +++ b/src/main/java/com/thealgorithms/Student.java @@ -0,0 +1,37 @@ +public class Student { + private String name; + private int roll; + private String dept; + private String batch; + + // DEFAULT CONSTRUCTOR + public Student() {} + + // PARAMETERIZED CONSTRUCTOR + public Student(String name, int roll, String dept, String batch) { + this.name = name; + this.roll = roll; + this.dept = dept; + this.batch = batch; + } + + // COPY CONSTRUCTOR + public Student(Student student) { + this.name = student.getName(); + this.roll = student.getRoll(); + this.dept = student.getDept(); + this.batch = student.getBatch(); + } + + // GETTERS + public String getName() { return name; } + public int getRoll() { return roll; } + public String getDept() { return dept; } + public String getBatch() { return batch; } + + // SETTERS + public void setName(String name) { this.name = name; } + public void setRoll(int roll) { this.roll = roll; } + public void setDept(String dept) { this.dept = dept; } + public void setBatch(String batch) { this.batch = batch; } +} \ No newline at end of file From fceeb7ac0bc7e3b7e9f13248f6b8edcee7132d19 Mon Sep 17 00:00:00 2001 From: "Md. Zunaied Nudar" Date: Wed, 20 Aug 2025 13:20:02 +0600 Subject: [PATCH 2/4] Calculator.java added in feature-calculator branch --- src/main/java/com/thealgorithms/Calculator.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/java/com/thealgorithms/Calculator.java diff --git a/src/main/java/com/thealgorithms/Calculator.java b/src/main/java/com/thealgorithms/Calculator.java new file mode 100644 index 000000000000..0c6a49990e71 --- /dev/null +++ b/src/main/java/com/thealgorithms/Calculator.java @@ -0,0 +1,16 @@ +public class Calculator { + // ADDITION + public double add(double a, double b) { return a + b; } + // SUBTRACTION + public double sub(double a, double b) { return a - b; } + // MULTIPLICATION + public double mul(double a, double b) { return a * b; } + // DIVISION + public double div(double a, double b) { + if (b == 0) { + System.out.println("Error: Division by zero!"); + return 0; + } + return a / b; + } +} \ No newline at end of file From 3a71c483797e4873a75a845e8ba7398baa49ca68 Mon Sep 17 00:00:00 2001 From: "Md. Zunaied Nudar" Date: Wed, 20 Aug 2025 13:47:16 +0600 Subject: [PATCH 3/4] Conflicting Calculator.java added in master branch --- src/main/java/com/thealgorithms/Calculator.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/java/com/thealgorithms/Calculator.java diff --git a/src/main/java/com/thealgorithms/Calculator.java b/src/main/java/com/thealgorithms/Calculator.java new file mode 100644 index 000000000000..2d1911fe3308 --- /dev/null +++ b/src/main/java/com/thealgorithms/Calculator.java @@ -0,0 +1,10 @@ +public class Calculator { + // ADDITION - CONFLICT + public double add(double a, double b) { return a + b + 1; } + // SUBTRACTION + public double sub(double a, double b) { return a - b; } + // MULTIPLICATION + public double mul(double a, double b) { return a * b; } + // DIVISION - CONFLICT + public double div(double a, double b) { return a / b; } +} \ No newline at end of file From 307d4afb62dd43bd8a8170fedca7283589fa4fca Mon Sep 17 00:00:00 2001 From: "Md. Zunaied Nudar" Date: Wed, 20 Aug 2025 14:15:56 +0600 Subject: [PATCH 4/4] Grade.java added in feature/grade branch --- src/main/java/com/thealgorithms/Grade.java | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/main/java/com/thealgorithms/Grade.java diff --git a/src/main/java/com/thealgorithms/Grade.java b/src/main/java/com/thealgorithms/Grade.java new file mode 100644 index 000000000000..236bb9ec3b07 --- /dev/null +++ b/src/main/java/com/thealgorithms/Grade.java @@ -0,0 +1,51 @@ +public class Grade { + public String getLetterGrade(int score) { + if (score < 0 || score > 100) { + return "Invalid score"; + } else if (score >= 80) { + return "A"; + } else if (score >= 70) { + return "B"; + } else if (score >= 50) { + return "C"; + } else if (score >= 30) { + return "D"; + } else { + return "F"; + } + } + + public double getGradePoint(int score) { + if (score < 0 || score > 100) { + return -1; + } else if (score >= 80) { + return 4.0; + } else if (score >= 70) { + return 3.0; + } else if (score >= 50) { + return 2.0; + } else if (score >= 30) { + return 1.0; + } else { + return 0.0; + } + } + + public boolean isPassing(int score) { return score >= 30; } + + public String getRemark(int score) { + if (score < 0 || score > 100) { + return "Invalid score"; + } else if (score >= 80) { + return "Excellent"; + } else if (score >= 70) { + return "Good"; + } else if (score >= 50) { + return "Average"; + } else if (score >= 30) { + return "Pass"; + } else { + return "Fail"; + } + } +} \ No newline at end of file