Question

Dr. Maine gives a set of exams during the semester in her chemistry class. At the...

Dr. Maine gives a set of exams during the semester in her chemistry class. At the end of the semester, she drops each of student’s lowest test score before averaging the scores. She has asked you to write a program that will read a student’s test scores as input and calculate the average with the lowest dropped. She also wants you to create another program that accepts the adjusted Average and returns the course grade.

The following pseudocode shows the steps for calculating the average of a set of test scores, with the lowest score dropped:

Calculate the total of the scores

Find the lowest score

Subtract the lowest score from the total. This gives the adjusted total

Divide the adjusted total by (number of scores -1). This is the average.

You will create a class Grader.java. with:

Constructor that accepts a double array of test scores. (10 points)

The Grader class will have a method named getLowestScore that returns the lowest score in the array (10 points)

A method getAverage that returns the average of the test scores with lowest dropped (10 points)

Draw a UML diagram to show the fields, constructor, and methods (10 points)

*Please use import java.util.Scanner; and import java.util.ArrayList; if it is possible.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi Friend, Question is long, so please post in two parts.

I have answered first part: Implementation of Class and Test .

Please repost for UML diagram.

public class Grader {

   private double grades[];

   public Grader(double arr[]) {
       grades = new double[arr.length];
       for(int i=0; i<arr.length; i++)
           grades[i] = arr[i];
   }

   public double getLowestScore() {

       double min = grades[0];
       for(int i=1; i<grades.length; i++)
           if(min > grades[i])
               min = grades[i];
       return min;
   }
  
   public double getAverage() {
      
       double sum = 0;
       for(int i=1; i<grades.length; i++)
           sum += grades[i];
      
       return (sum-getLowestScore())/(grades.length-1);
      
   }
   public static void main(String[] args) {

   }

}

#############

import java.util.Scanner;

public class GraderTest {
  
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
      
       System.out.print("how many grades want to enter: ");
       int n = sc.nextInt();
      
       double [] grades = new double[n];
       System.out.println("Enter "+n+" grades: ");
       for(int i=0; i<n; i++)
           grades[i] = sc.nextDouble();
      
       Grader obj = new Grader(grades);
      
       System.out.println("Lowest scote: "+obj.getLowestScore());
       System.out.println("Average scote: "+obj.getAverage());
   }

}

▼やや▼ | Quick Access 哈擎8/ Scala D Linked List.j , proble @Javado 다 Declara y Search hweek1; onsol× Progre d Remote. TestNG <te

Add a comment
Know the answer?
Add Answer to:
Dr. Maine gives a set of exams during the semester in her chemistry class. At the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a class named TestScores. The class constructor should accept an array of test scores as...

    Write a class named TestScores. The class constructor should accept an array of test scores as its argument. The class should have a method that returns the average of the test scores. If any test score in the array is negative or greater than 100, the class should throw an IllegalArgumentException. Demonstrate the class in a program (create a Driver class in the same file). The program should ask the user to input the number of test scores to be...

  • c++ Instructions Overview In this programming challenge you will create a program to handle student test...

    c++ Instructions Overview In this programming challenge you will create a program to handle student test scores.  You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...

  • Write a class named TestScores. The class constructor should accept an array test scores as its...

    Write a class named TestScores. The class constructor should accept an array test scores as its argument. The class should a method that returns the average of the test scores. If any test score is negative or greater than 100, the class should throw an IllegalArgumentException. Demonstrate this with an array of five items. This is JAVA program.

  • --C++-- --spc16-7.cpp-- // Chapter 16, Programming Challenge 7: TestScores class #include <iostream> #include "TestScores.h" #include "NegativeScore.h"...

    --C++-- --spc16-7.cpp-- // Chapter 16, Programming Challenge 7: TestScores class #include <iostream> #include "TestScores.h" #include "NegativeScore.h" using namespace std; int main() { // Constant for the number of test scores const int NUM_SCORES = 5;       try    {        // Create an array of valid scores.        int myScores[NUM_SCORES] = { 88, 90, 93, 87, 99 };        // Create a TestScores object.        //TestScores myTestScores(myScores, NUM_SCORES); // optional constructor        TestScores myTestScores(myScores);...

  • Using Python, Write a class named Scores. This data structure will store a collection of lab...

    Using Python, Write a class named Scores. This data structure will store a collection of lab scores (or programs scores or any other collection of scores). Since numbered assignments generally start with 1 – your first assignment this summer was lab 1 – the user of this class will think of this collection as being a 1-based list of values. All the methods which require a lab number will assume that value is based upon what the user sees, a...

  • Java Program 1. Write a class that reads in a group of test scores (positive integers...

    Java Program 1. Write a class that reads in a group of test scores (positive integers from 1 to 100) from the keyboard. The main method of the class calls a few other methods to calculate the average of all the scores as well as the highest and lowest score. The number of scores is undetermined but there will be no more than 50. A negative value is used to end the input loop. import java.util.Scanner; public class GradeStat {...

  • During a semester, a class of n=50 students took two exams: a midterm and final. The...

    During a semester, a class of n=50 students took two exams: a midterm and final. The mean source for the midterm exam is 80 points with the standard deviation of 6 points. The mean score for the final exam is 85 points with the standard deviation of 10 points. The calculated coefficient of correlation (r) for the two scores is 0.75. Q. Calculate the value of SSE (sum of square of error) using the above information.

  • PHYTHON NOT JAVA!!! need HELP ASAP!!! This program gets a series of test scores and #...

    PHYTHON NOT JAVA!!! need HELP ASAP!!! This program gets a series of test scores and # calculates the average of the scores with the # lowest score dropped. def main(): # Get the test scores from the user and store it in a variable called scores.    # Get the total of the test scores and store it in a variable called total.    # DONE - Get the lowest test score and store it in a variable called lowest....

  • Please Write in C++ (10-30) @ 11:55pm 1.9 HW7 This homework assignment gives you the opportunity...

    Please Write in C++ (10-30) @ 11:55pm 1.9 HW7 This homework assignment gives you the opportunity to practice functions, functions that call other functions, reference variables, logical statements (what is meant by logical statement is a statement such as if, if/else if, switch), and input validation, HW7 (Graded out of 100) A talent competition has 5 judges, each of whom awards a score between 0 and 10 for each performer. Fractional scores, such as 8.3, are allowed. A performer's final...

  • #ifndef STUDENTTESTSCORES_H #define STUDENTTESTSCORES_H #include <string> using namespace std; const double DEFAULT_SCORE = 0.0; class StudentTestScores...

    #ifndef STUDENTTESTSCORES_H #define STUDENTTESTSCORES_H #include <string> using namespace std; const double DEFAULT_SCORE = 0.0; class StudentTestScores { private: string studentName; // The student's name double *testScores; // Points to array of test scores int numTestScores; // Number of test scores // Private member function to create an // array of test scores. void createTestScoresArray(int size) { numTestScores = size; testScores = new double[size]; for (int i = 0; i < size; i++) testScores[i] = DEFAULT_SCORE; } public: // Constructor StudentTestScores(string...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT