Question
Grade Calculation Class Teacher of class V, was busy in calculating the grade for each student in her class, based on his/her total marks obtained
Grade Calculation
Class Teacher of class V, was busy in calculating the grade for each student in her class, based on his/her total marks obtained in SA1 assessment. Help the class teacher in completing the task quickly by providing a Java Solution . Implement the solution using Threads so that the task can be completed faster.
Consider the class given below.
<
Thread()
run()
<
private studName String
private marks int
private result char
getstudName() String
setStudName() String
getMarks(): int[]
setMarks()
getResult():char
setResult():char
GradeCalculator(String,int[])
run():void
<
Main()
Creat a class called GradeCalculator that extends Thread with the following private attributes.
String studName,
char result,
int[] marks
Include appropriate getters/setters.
Writ a two argument constructor in the GradeCalculator class with arguments - name and marks. And set the values via constructor.
Writ a main class and implement the below task
Get the number of threads initially from the user. Each Thread is responsible for calculating the grade of respective student.
Hint: Override the run method to implement the above task
Assumption: Each student will have only five subjects and marks of each subject will be greater than or equal to 0 and lesser than or equal to 100. Hence the maximum Total marks obtained by each student will be 500. And the minimum Total marks obtained by each student will be 0.
Calculate the grade based on total marks (sum of all marks) obtained by each student as below and set the same in result attribute of GradeCalculator class for respective student
Total Marks Grade
400 to 500 A
300 to 399 B
200 to 299 C
Less than 200 E
Display the result as shown below
Sample input/output
Enter the number of Threads:
4
Enter the String:
Jeba:100:80:90:40:55
Enter the String
David:10:8:9:40:5
Enter the String
Adam:90:80:90:50:75
Enter the String
Rohit:99:99:99:99:99
Jeba:B
David:E
Adam:B
Rohit:A
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started