Compute Your Grade

Sure you can use use a spreadsheet, but why not use Java? Below are two classes you can use to compute your grade yourself. Just replace the perfect scores with the score you earned, and comment out the scores you were absent for, and it should match the percentage on PlusPortals (if PlusPortals were working properly)! You can also speculate on what you need to get on your Semester Exam. You can even add some code to sort your grades by date or percentage if you like!

Score.java


public class Score {
	private int date,score,possible;
	private String name;
	public Score (String name,int date, int possible, int score){
		this.name=name;
		this.date=date;
		this.setPossible(possible);
		this.setScore(score);
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	public int getPossible() {
		return possible;
	}
	public void setPossible(int possible) {
		this.possible = possible;
	}
	public String toString()
	{
		return date+" "+name+" "+score+" out of "+possible+" or  "+100*(double)score/possible+"%";
	}

}

Grades.java

import java.util.ArrayList;

public class Grades {

	public static void main(String[] args) {
		ArrayList<Score> grades= new ArrayList<Score>();

		//g.add(new Score("Sem1ExamMC", 1215, 100, 100  ));
		//g.add(new Score("Sem1ExamFR", 1215, 100, 100  ));
		grades.add(new Score("T5MC", 1209, 50, 50  ));
		grades.add(new Score("T5FR", 1209, 50, 50  ));
		grades.add(new Score("EL2", 1203, 4,4 ));
		grades.add(new Score("DQ2-18", 1203, 10, 10  ));
		grades.add(new Score("DQ2-17", 1201, 5, 5  ));
		grades.add(new Score("EL1", 1123, 4, 4  ));
		grades.add(new Score("DQ2-14", 1119, 5, 5  ));
		grades.add(new Score("T4MC", 1117, 50, 50  ));
		grades.add(new Score("T4FR", 1117, 50, 50  ));
		grades.add(new Score("PicLabTest", 1106, 20, 20  ));
		grades.add(new Score("PicLQ", 1104, 5, 5  ));
		grades.add(new Score("FRPicLab", 1102, 5, 5  ));
		grades.add(new Score("PicLab78", 1029, 6, 6  ));
		grades.add(new Score("MCQPL", 1029, 10, 10  ));
		grades.add(new Score("PL6", 1027, 4, 4  ));
		grades.add(new Score("PL5", 1023, 7, 7  ));
		grades.add(new Score("PL4", 1019, 5, 5  ));
		grades.add(new Score("PL3", 1015, 5, 5  ));
		grades.add(new Score("Qtr1FRExam", 1002, 100, 100  ));
		grades.add(new Score("Qtr1MCExam", 1002, 100, 100  ));
		grades.add(new Score("T2FR", 928, 50, 50  ));
		grades.add(new Score("T2MC", 928, 50, 50  ));
		grades.add(new Score("DQ15", 924, 10, 10  ));
		grades.add(new Score("ML5", 922, 10, 10  ));
		grades.add(new Score("DQ14", 922, 10, 10  ));
		grades.add(new Score("DQ13", 918, 10, 10  ));
		grades.add(new Score("ML4", 916, 10, 10  ));
		grades.add(new Score("DQ12", 916, 10, 10  ));
		grades.add(new Score("DQ11", 914, 10, 10  ));
		grades.add(new Score("ML1-2", 910, 10, 10  ));
		grades.add(new Score("T1FR", 908, 50, 50  ));
		grades.add(new Score("T1MC", 908, 50, 50  ));
		grades.add(new Score("DQ8", 903, 10, 10  ));
		grades.add(new Score("DQ7", 901, 10, 10  ));		
		grades.add(new Score("LAb1", 828, 10, 10  ));
		grades.add(new Score("FRQ2", 828, 10, 10  ));
		grades.add(new Score("MCQ1", 826, 10, 10  ));
		grades.add(new Score("CW5", 826, 4, 4  ));
		grades.add(new Score("FRQ1", 824, 10, 10  ));
		grades.add(new Score("CW2", 818, 4, 4  ));
		int sum=0, tot=0;
		for(Score s: grades){
			sum+=s.getScore();
			tot+=s.getPossible();
			System.out.println(s);
		}
		System.out.println("total: "+sum+" out of "+tot+" or "+100*(double)sum/tot+"%");


        // 843 total points before the final 1043 after (if you were never absent)
	}

}