Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Provide a complete program that handles the entry and display of homework scores

ID: 3654216 • Letter: P

Question

Provide a complete program that handles the entry and display of homework scores. As part of your program, provide a HwScore class that contains the points earned on a particular homework and also the maximum possible points on that homework. In order to keep track of the overall average, the HwScore class also contains the total points earned on all homework combined and the total possible points on all homework combined. In order to determine letter grades, the HwScore class specifies cutoff values for the A, B, C, and D letter grades.

Explanation / Answer

// create a new project // create a package called hw // create the first file and name it YourNameProg2.java // create the second file HwScore.java -- see below // Warning: yahoo answers cuts text off, so where you see the ... be careful the cutoff text is = overallEarnedPoints2, //////////////////////////////////////… package hw; /* Provide a main driver method. It should: • Instantiate four HwScore objects and store them in the variables hw1, hw2, hw3, and hw4. In the instantiations, initialize the objects to these values: hw1: 26.5 earned points, 30 possible points hw2: 29 earned points, 27.5 possible points hw3: 0 earned points, 20 possible points hw4: 16 earned points, 20 possible points For hw1, hw2, and hw3 (but not hw4), call printGrade. Call printOverallGrade * */ public class YourNameProg2 { public static void main (String[] args) { HwScore hw1 = new HwScore(26.5,30 ); HwScore hw2 = new HwScore(29,27.5 ); HwScore hw3 = new HwScore(0,20 ); HwScore hw4 = new HwScore(16,20 ); // For hw1, hw2, and hw3 (but not hw4), call printGrade. hw1.printGrade(); hw2.printGrade(); hw3.printGrade(); double overallEarnedPoints2 = hw1.earnedPoints + hw2.earnedPoints + hw3.earnedPoints; double overallPossiblePoints2 = hw1.possiblePoints + hw2.possiblePoints + hw3.possiblePoints; //Call printOverallGrade hw1.printOverallGrade(overallEarnedPoint… overallPossiblePoints2,3); } } ////////////////////////////////// second java file //////////////////////// // name this HwScore.java package hw; public class HwScore { public double earnedPoints; public double possiblePoints; HwScore (double earnedPts, double possiblePts) { earnedPoints = earnedPts; possiblePoints = possiblePts; } /* printGrade method that prints a particular homework’s earned points, possible points, and letter grade. The letter grade is based on this scale: A 90%, B 80%, C 70%, D 60%, F < 60%. */ public void printGrade() { double percentageGrade = 0.0; char letterGrade = ' '; percentageGrade = (earnedPoints / possiblePoints) * 100; if (percentageGrade >= 90) { letterGrade = 'a'; } else if (percentageGrade >= 80 && percentageGrade < 90) { letterGrade = 'b'; } else if (percentageGrade >= 70 && percentageGrade < 80) { letterGrade = 'c'; } else if (percentageGrade >= 60 && percentageGrade < 70) { letterGrade = 'd'; } else letterGrade = 'f'; System.out.println(" This homework's earned points are: " + earnedPoints); System.out.println("This homework's possible points are: " + possiblePoints); System.out.println("This homework's letter grade is: " + letterGrade); } /* Implement a class method named printOverallGrade that prints the overall earned points, overall possible points, and overall letter grade. */ public void printOverallGrade(double overAllEarnedPoints, double overAllPossiblePoints, double totalAssignments) { // totalScores is the total of homework Assignments double overAllEarnedPoints2 = overAllEarnedPoints; double overAllPossiblePoints2 = overAllPossiblePoints; double percentageGrade = 0.0; char letterGrade = ' '; percentageGrade = (overAllEarnedPoints2 / overAllPossiblePoints2) * 100; if (percentageGrade >= 90) { letterGrade = 'a'; } else if (percentageGrade >= 80 && percentageGrade < 90) { letterGrade = 'b'; } else if (percentageGrade >= 70 && percentageGrade < 80) { letterGrade = 'c'; } else if (percentageGrade >= 60 && percentageGrade < 70) { letterGrade = 'd'; } else letterGrade = 'f'; System.out.println(" Overall earned points are: " + overAllEarnedPoints2); System.out.println("Overall possible points are: " + overAllPossiblePoints2); System.out.println("Overall letter grade is: " + letterGrade); } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote