Develop the Internal mark calculation system based on the attendance percentage using Java. Get the student name, register number, total number of working days in the semester and Number of days present. Calculate attendance percentage of the students and award attendance mark based on the following condition. Attendance percentage >=90 – 5 MarksAttendance percentage >=80 and < 90 – 4 MarksAttendance percentage >=75 and < 80 – 3 MarksAttendance percentage < 75 - 0 MarksImplement using inheritance
Question
Develop the Internal mark calculation system based on the attendance percentage using Java. Get the student name, register number, total number of working days in the semester and Number of days present. Calculate attendance percentage of the students and award attendance mark based on the following condition. Attendance percentage >=90 – 5 MarksAttendance percentage >=80 and < 90 – 4 MarksAttendance percentage >=75 and < 80 – 3 MarksAttendance percentage < 75 - 0 MarksImplement using inheritance
Solution
Here is a simple implementation of the problem in Java using inheritance.
First, we create a base class Student:
public class Student {
String name;
int registerNumber;
int totalWorkingDays;
int daysPresent;
public Student(String name, int registerNumber, int totalWorkingDays, int daysPresent) {
this.name = name;
this.registerNumber = registerNumber;
this.totalWorkingDays = totalWorkingDays;
this.daysPresent = daysPresent;
}
public double calculateAttendancePercentage() {
return (double) daysPresent / totalWorkingDays * 100;
}
}
Then, we create a derived class InternalMarkCalculator:
public class InternalMarkCalculator extends Student {
public InternalMarkCalculator(String name, int registerNumber, int totalWorkingDays, int daysPresent) {
super(name, registerNumber, totalWorkingDays, daysPresent);
}
public int calculateMarks() {
double attendancePercentage = calculateAttendancePercentage();
if (attendancePercentage >= 90) {
return 5;
} else if (attendancePercentage >= 80) {
return 4;
} else if (attendancePercentage >= 75) {
return 3;
} else {
return 0;
}
}
}
Finally, we can use these classes in a main method:
public class Main {
public static void main(String[] args) {
InternalMarkCalculator student = new InternalMarkCalculator("John Doe", 123, 180, 170);
System.out.println("Student " + student.name + " gets " + student.calculateMarks() + " marks for attendance.");
}
}
This program will calculate the attendance percentage and award marks based on the given conditions.
Similar Questions
Java Program To Accept the Marks of a Student and Find the Total Marks and Percentage
Design a Student Mark List Generation System using Java.Define a class to store student's register number, name,attendance percentage and an integer array to store five subject marks.Define methods to read and print the student's details. Generate "InvalidMarksException: Marks must be within the range 0 to 30" , If the marks entered are less than 0 or greater than 30. Generate “InsufficientAttendanceException: Minimum Attendance Required is 75%” , if the attendance is less than 75%. Print the marklist only if there are no exceptions generated.Input FormatRegno – intName – StringAttendance – doubleMark1, Mark2, Mark3, Mark4, Mark5 – int Array elementsOutput FormatIf Exception is generated, display the message thrown by theException.Else, display the student details as shown below.Regno:Name:Attendance:Mark1:Mark2:Mark3:Mark4:Mark5:
You have been assigned to develop a Course Enrollment and Grade Management System in Java for a university. The system should provide functionality to enroll students in courses, assign grades to students, and calculate overall course grades for each student. The project should demonstrate the effective utilization of static methods and variables to keep track of enrollment and grade-related information across multiple instances of the Student and Course classes. It should also showcase your ability to manipulate object state and define behavior through instance methods.Requirements:Student Class:The Student class should have private instance variables to store student information such as name, ID, and enrolled courses.Implement appropriate access modifiers and provide public getter and setter methods for accessing and updating student information.Design a method to enroll students in courses. It should accept a Course object as a parameter and add the course to the student's enrolled courses.Implement a method to assign grades to students. It should accept a Course object and a grade for the student and update the student's grade for that course. Course Class:The Course class should have private instance variables to store course information such as course code, name, and maximum capacity.Use appropriate access modifiers and provide public getter methods for accessing course information.Implement a static variable to keep track of the total number of enrolled students across all instances of the Course class.Design a static method to retrieve the total number of enrolled students.CourseManagement Class:The CourseManagement class should have private static variables to store a list of courses and the overall course grades for each student.Use appropriate access modifiers to control access to the variables.Implement static methods to add new courses, enroll students, assign grades, and calculate overall course grades for each student.The addCourse method should accept parameters for course information and create a new Course object. It should add the course to the list of courses.The enrollStudent method should accept a Student object and a Course object. It should enroll the student in the course by calling the appropriate method in the Student class.The assignGrade method should accept a Student object, a Course object, and a grade. It should assign the grade to the student for that course by calling the appropriate method in the Student class.The calculateOverallGrade method should accept a Student object and calculate the overall course grade for that student based on the grades assigned to them.Administrator Interface:Develop an interactive command-line interface for administrators to interact with the Course Enrollment and Grade Management System.Display a menu with options to add a new course, enroll students, assign grades, and calculate overall course grades.Prompt the administrator for necessary inputs and call the appropriate methods in the CourseManagement and Student classes to perform the requested operations.Implement error handling to handle cases where invalid inputs are provided or when enrolling students in courses that have reached their maximum capacity.Documentation:Provide comprehensive documentation for the project, explaining the purpose and usage of each class, method, and variable.Describe how static methods and variables are utilized to track enrollment and grade-related information across multiple instances of the Student and Course classes.Include instructions for running the program and interacting with the administrator interface.
The system records attendance details for multiple students, capturing their name, roll number, and attendance status for various subjects. Each subject has a total of 20 classes in a semester. Users can input the number of classes students have attended and calculate their attendance percentage. If a student's attendance falls below 75% for a particular subject, the system identifies it and calculates the number of classes they need to attend to reach a minimum of 75% before the semester concludes.Sample Input:
Write a Java program that determines a student’s grade. The program will read three types ofscores(quiz, mid-term, and final scores) and determine the grade based on the following rules: -if theaverage score >=90% =>grade=A -if the average score >= 70% and <90% => grade=B -if theaverage score>=50% and <70% =>grade=C -if the average score<50% =>grade=F
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.