PYTHON PROGRAMMING/JAVA Write a program to calculate the final or interim grades
ID: 3859676 • Letter: P
Question
PYTHON PROGRAMMING/JAVA
Write a program to calculate the final or interim grades for the class. The calculation would involve points obtained by a number of students in various assignments, quizzes, projects, midterm exams and the final exam. Please use the same grading rubric to allocate the percent-wise share under different heads as indicated in the syllabus posted on eLearning for your course. It is also indicated as follows: Grading Rubric Exams (2) - 20% each) Final Exam - 25% Assignments, Quizzes, Projects - 30% (One worst performance dropped) Attendance - 59% You can declare and initialize a 2-D array containing the grade points and attendance of the students inside the program or you could do this using structures). You can design the array so as to keep the assignments, quizzes and projects at the beginning of the array, followed by the midterm, then the final and the attendance at the end, identify individual students through a simple student number that could be an integer starting from land then counting ahead. Please keep in mind that if you are calculating interim grades, the points from some heads viz. the final exam might not be available at the time. You will need to drop one worst performance from assignments, quizzes and projects from calculation (but not from the exams or attendance, Assume that all evaluations have a common denominator (maximum points) of 100 points. You will need to calculate the attendance percentage values for the students using the classes attended by the students and the total number of classes held. While the attendance values can be set using the same array as the one used for the grade points, you should set the total number of classes held at the beginning of the programThese two could then be used to calculate the attendance percentage , while calculating this value, bump any fractional values to the next higher integerFor example, an attendance of 64.1 should be made 65, an attendance of 76.9 should be made 77, and so on. Your program has to be flexible in the number of students being considered for grading, the number of assignments, quizzes or projects and should be able to consider any specified number of students for grading with any number of assignments at different points of time in the course, so please do not hard code any limiting values.Explanation / Answer
This is tried and tested modifications can be made but make sure about the flow.
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
public class Grades
{
int stu_tot;
String[][] stu_info= new String[stu_tot][2];
float[][] stu_grade= new float[stu_tot][2];
float[][] stu_finalm= new float[stu_tot][5];
float[][] stu_aqp= new float[stu_tot][3];
float[][] stu_examh= new float[stu_tot][2];
Grades(){}
void get_info()
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter the student strength: ");
stu_tot=sc.nextInt();
for(int i=0;i<stu_tot;i++) // Getting Student basic details
{
System.out.println("Enter the student ID: ");
stu_info[i][0]=sc.next();
System.out.println("Enter the student name: ");
stu_info[i][1]=sc.next();
}
for(int i=0;i<stu_tot;i++) // Getting Student examh details
{
System.out.println("Enter the examh1 marks: ");
stu_examh[i][0]=sc.nextFloat();
System.out.println("Enter the examh2 marks: ");
stu_examh[i][1]=sc.nextFloat();
}
for(int i=0;i<stu_tot;i++) // Getting Student aqp details
{
System.out.println("Enter the assignment marks: ");
stu_aqp[i][0]=sc.nextFloat();
System.out.println("Enter the quiz marks: ");
stu_aqp[i][1]=sc.nextFloat();
System.out.println("Enter the project marks: ");
stu_aqp[i][2]=sc.nextFloat();
}
for(int i=0;i<stu_tot;i++) // Getting Student attendance and final marks details
{
System.out.println("Enter the attendance: ");
stu_grade[i][0]=sc.nextFloat();
System.out.println("Enter the final marks: ");
stu_grade[i][1]=sc.nextFloat();
}
}
void calc()
{
for(int i=0;i<stu_tot;i++) // Getting Student attendance and final marks details
{
stu_finalm[i][0]=Math.ceil(stu_grade[i][0])*0.05; // attendance
stu_finalm[i][1]= stu_grade[i][1]*0.25; //final
stu_finalm[i][2]= (stu_examh[i][0]*0.20)+(stu_examh[i][1]*0.20); //examhs
if((stu_aqp[i][0]>stu_aqp[i][1]) && (stu_aqp[i][0]>stu_aqp[i][2])) // AQP
{
if(stu_aqp[i][1]>stu_aqp[i][2])
stu_finalm[i][3]= ((stu_aqp[i][0]+stu_aqp[i][1]));
else
stu_finalm[i][3]= ((stu_aqp[i][0]+stu_aqp[i][2]));
}
else if((stu_aqp[i][1]>stu_aqp[i][0]) && (stu_aqp[i][1]>stu_aqp[i][2])) // AQP
{
if(stu_aqp[i][0]>stu_aqp[i][2])
stu_finalm[i][3]= ((stu_aqp[i][0]+stu_aqp[i][1]));
else
stu_finalm[i][3]= ((stu_aqp[i][1]+stu_aqp[i][2]));
}
else if((stu_aqp[i][2]>stu_aqp[i][0]) && (stu_aqp[i][2]>stu_aqp[i][1])) // AQP
{
if(stu_aqp[i][0]>stu_aqp[i][1])
stu_finalm[i][3]= ((stu_aqp[i][2]+stu_aqp[i][0]));
else
stu_finalm[i][3]= ((stu_aqp[i][2]+stu_aqp[i][1]));
}
float sum=stu_finalm[i][0]+stu_finalm[i][1]+stu_finalm[i][2]+stu_finalm[i][3];
// if (sum<100 && sum >=93)
stu_finalm[i][4]=sum;
}
}
void display()
{
for(int i=0;i<stu_tot;i++) // Getting Student grade and display
{
char grde;
if (sum<100 && sum >=93)
grde='A';
else if (sum<92 && sum >=90)
grde='A-';
else if (sum<92 && sum >=90)
grde='A-';
else if (sum<89 && sum >=87)
grde='B+';
else if (sum<86 && sum >=83)
grde='B';
else if (sum<82 && sum >=80)
grde='B-';
else if (sum<79 && sum >=77)
grde='C+';
else if (sum<76 && sum >=73)
grde='C';
else if (sum<72 && sum >=70)
grde='C-';
else if (sum<69 && sum >=67)
grde='D+';
else if (sum<66 && sum >=60)
grde='D';
else if (sum<60 )
grde='F';
System.out.println(stu_info[i][1]+ " AQPT : "+stu_finalm[i][3]+ "AQPT %: "+(stu_finalm[i][3]/2)*0.30+ " MET : " +(stu_examh[i][0]+stu_examh[i][1])+ " MET% : "+stu_finalm[i][2]+ "FE : "+stu_grade[i][1]+ " FE% :"+ stu_finalm[i][1]+ " Att%" + stu_finalm[i][0]+ "NG: "+stu_finalm[i][4]+ " LG :"+grde );
}
}
public static void main (String []a) ////// main method ///////
{
Grades ob1=new Grades();
ob1.get_info();
ob1.calc();
ob1.display();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.