Objective: Use the java Math functions to find the highest, lowest, and average of a students grades for 4 quarters.
The methods of the Math class are examples of static methods. Static methods are methods that do not operate on objects. You call them on a class. Math is the name of a class, it is not the name of an object. Math is unlike other methods you have used, you do Not create a "new" Math object.
For the AP exam you are only required to know the 5 Math methods below. However
there are many others which can be usefull.
1) int abs(int x)
2) double abs(double x)
3) double pow(double base, double exponent)
4) double sqrt(double x)
5) double random()
Assignment:
/** >>>>>>>>>>>>>>>>>>> CLASS QtrGrades <<<<<<<<<<<<<<<<<< * Finds the highest, lowest, average of all 4 grades, * and the average of the best 3 quarters. */ public class QtrGrades { private int qtr1, qtr2, qtr3, qtr4; /** * Constructor: Sets grades for qtr1, qtr2, qtr3, qtr4 */ public QtrGrades(int q1, int q2, int q3, int q4) { qtr1 = q1; qtr2 = q2; qtr3 = q3; qtr4 = q4; } /** * Uses the Math.max function to return the highest * of the 4 quarter grades */ public int bestQtr() { // <<<<<<<<<<<<<< complete the code >>>>>>>>>>>>>>>>>> } /** * Uses the Math.min function to return the lowest * of the 4 quarter grades */ public int worstQtr() { // <<<<<<<<<<<<<< complete the code >>>>>>>>>>>>>>>>>> } /** * Returns the average of the 4 quarter grades as a double */ public double qtrAverage() { // <<<<<<<<<<<<<< complete the code >>>>>>>>>>>>>>>>>> } /** * Returns the average of the 3 highest quarters * (the lowest quarter grade is dropped) */ public double bestThreeAverage() { // <<<<<<<<<<<<<< complete the code >>>>>>>>>>>>>>>>>> } }