/** * CS-20 Asn 6 * MyGradebook.java * Purpose: Calculate and report on my grade * * @author * @version */ public class MyGradebook { public static final double ASN_WEIGHT = .40; public static final double MID_WEIGHT = .25; public static final double FNL_WEIGHT = .35; public static final int SCORE_TYPES = 3; //Sample data -- do not change for this assignment //Replace with your own data to actually use it //Row 0: possible scores, Row 1: actual scores public static final int[][] ASN_DATA = {{10, 20, 20, 20}, {10, 20, 21, 22}}; public static final int[][] MID_DATA = {{50}, {40}}; public static final int[][] FNL_DATA = {{0}, {0}}; private MyScores scores[]; /** * Contructor that shows scores */ public MyGradebook() { scores = new MyScores[SCORE_TYPES]; //instantiate each object and assign to scores array } /** * Returns the raw data of the scores array * * @return The scores array. */ public MyScores[] getScores() { return scores; } /** * Report score results */ public void reportGrade() { double total = 0.0; double score = 0.0; System.out.println("Weighted Percentages:"); //accumulate scores and display weighted percentages for each area System.out.println("\nTotal to date: " + total); System.out.println("Letter grade to date: " + MyScores.toLetterGrade(total)); total = total / (1 - FNL_WEIGHT); System.out.println("Total excluding final: " + total); System.out.println("Letter grade excluding final: " + MyScores.toLetterGrade(total)); } /** * Create a MyGradebook object * * @param args -- not used */ public static void main(String args[]) { MyGradebook gb = new MyGradebook(); gb.reportGrade(); } } /** * CS-20 Asn6 * MyScores.java * Purpose: * * @author * @version */ public abstract class MyScores { public static final double MIN_A = 0.9; public static final double MIN_B = 0.8; public static final double MIN_C = 0.7; public static final double MIN_D = 0.6; private String name = "No name"; private int[][] myData; /** * Default constructor initializes data with empty array */ public MyScores() { myData = new int[0][0]; } /** * Abstract method to calculate scores overridden in subclasses * * @return The calculated percentages from the raw data */ public abstract double calcPercentage(); /** * General purpose method to convert percentage to letter grades * * @param percentage The percentage to convert */ public static char toLetterGrade(double percentage) { //implement calculation and return appropriate values return 'A'; } } /** * CS-20 Asn06 * MyAsn.java * Purpose: * * @author * @version */ public class MyAsn extends MyScores { /** * Call superclass constructor passing parameters * * @param areaName The name of the MyScores object * @param areaWeight The score data * @param data The score data */ public MyAsn(String areaName, double areaWeight, int[][] data) { } /** * Calculate totals from raw data * * @return The calculated percentages from the raw data */ public double calcPercentage() { //implement calculation and return appropriate values return 0.0; } }