Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
double assignmentTotal = 0.0; // total points possible
for (int i = 0; i < numAssignment; i++) {
assignmentTotal += s.nextDouble(); // adds each assignment weight
}
double participationTotal = s.nextDouble(); // max possible participation points
int numStudents = s.nextInt(); // number of students
// arrays for each section of the total grade
double[] assignments = new double[numStudents];
double[] participation = new double[numStudents];
double[] midterm = new double[numStudents];
double[] finalExam = new double[numStudents];
for (int i = 0; i < numStudents; i++) { // puts grades for each student in array
s.next();
s.next();
participation[i] = (s.nextDouble() / (participationTotal * 0.8)) * 100;
if (participation[i] > 100) {
participation[i] = 100;
}
assignments[i] = 0.0;
for (int j = 0; j < numAssignment; j++) {
assignments[i] += s.nextDouble();
}
assignments[i] = (assignments[i] / assignmentTotal) * 100;
midterm[i] = s.nextDouble();
finalExam[i] = s.nextDouble();
}
// converts to normalized scores
double[] normalizedFinal = new double[numStudents];
double[] normalizedMidterm = new double[numStudents];
for (int i = 0; i < numStudents; i++) { // for final exam and midterm
normalizedFinal[i] = (finalExam[i] - average(finalExam)) / findSD(finalExam, average(finalExam));
normalizedMidterm[i] = (midterm[i] - average(midterm)) / findSD(midterm, average(midterm));
}
// adds curve to grade
double[] curved = new double[numStudents];
curved = curve(normalizedFinal);
double[] curvedMidterm = new double[numStudents];
curvedMidterm = curve(normalizedMidterm);
// multiplies grade by weights
String[] grades = new String[numStudents];
for (int i = 0; i < grades.length; i++) {
grades[i] = toLetter((participation[i] * 0.15) + (assignments[i] * 0.4) + (curvedMidterm[i] * 0.2) + (curved[i] * 0.25));
}
// prints each count of a grade
System.out.println("A : " + search(grades, "A"));
System.out.println("A-: " + search(grades, "A-"));
System.out.println("B+: " + search(grades, "B+"));
System.out.println("B : " + search(grades, "B"));
System.out.println("B-: " + search(grades, "B-"));
System.out.println("C+: " + search(grades, "C+"));
System.out.println("C : " + search(grades, "C"));
System.out.println("C-: " + search(grades, "C-"));
System.out.println("D+: " + search(grades, "D+"));
System.out.println("D : " + search(grades, "D"));
System.out.println("F : " + search(grades, "F"));
}
// converts number grade to letter grade
public static String toLetter(double grade) {
if (grade >= 94) {
return ("A");
} else if (grade >= 90) {
return ("A-");
} else if (grade >= 86) {
return ("B+");
} else if (grade >= 83) {
return ("B");
} else if (grade >= 80) {
return ("B-");
} else if (grade >= 76) {
return ("C+");
} else if (grade >= 73) {
return ("C");
} else if (grade >= 70) {
return ("C-");
} else if (grade >= 65) {
return ("D+");
} else if (grade >= 60) {
return ("D");
} else {
return ("F");
}
}
// calculates average
public static double average(double[] list) {
double sum = 0.0;
double avg = 0.0;
for (int i = 0; i < list.length; i++) {
sum += list[i];
avg = sum / list.length;
}
return avg;
}
// finds standard deviation
public static double findSD(double[] list, double average) {
double[] dev = new double[list.length];
for (int i = 0; i < list.length; i++) {
dev[i] = Math.pow(average - list[i], 2);
}
double sd = Math.sqrt(average(dev));
return sd;
}
// curves grades according to normalized score
public static double[] curve(double[] normalized) {
double[] grade = new double[normalized.length];
for (int i = 0; i < normalized.length; i++) {
double x = normalized[i];
if (x >= 2.0) {
grade[i] = 100.0;
} else if (x < 2.0 && x > 1.0) {
grade[i] = (((x - 1.0) / (2.0 - 1.0)) * (100.0 - 94.0)) + 94.0;
} else if (x == 1.0) {
grade[i] = 94;
} else if (x < 1.0 && x > 0) {
grade[i] = (((x - 0) / (1.0 - 0)) * (94.0 - 85.0)) + 85.0;
} else if (x == 0) {
grade[i] = 85.0;
} else if (x < 0 && x > -1.0) {
grade[i] = (((x + 1.0) / (0 + 1.0)) * (85.0 - 75.0)) + 75.0;
} else if (x == -1.0) {
grade[i] = 75.0;
} else if (x < -1.0 && x > -1.5) {
grade[i] = (((x + 1.5) / (-1.0 + 1.5)) * (75.0 - 65.0)) + 65.0;
} else if (x == -1.5) {
grade[i] = 65.0;
} else if (x < -1.5 && x > -2.0) {
grade[i] = (((x + 2.0) / (-1.5 + 2.0)) * (65.0 - 55.0)) + 55.0;
} else if (x == -2.0) {
grade[i] = 55.0;
} else if (x < -2.0 && x > -3.0) {
grade[i] = (((x + 3.0) / (-2.0 + 3.0)) * (55.0 - 30.0)) + 30.0;
} else if (x == -3.0) {
grade[i] = 30.0;
} else if (x < -3.0 && x > -4.0) {
grade[i] = ((x + 4.0) / (-3.0 + 4.0)) * 30.0;
} else {
grade[i] = 0.0;
}
}
return grade;
}
// checks if strings are equal
public static int search(String[] array, String str) {
int total = 0;
for (int i = 0; i < array.length; i++) {
if (array[i].equals(str)) {
total++;
}
}
return total;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team