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
  • 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...

  • 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.

  • #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...

  • 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...

  • Write a C++ program to keep records and perform statistical analysis for a class of 20...

    Write a C++ program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score. The program will prompt the user to choose the operation of records from a menu as shown below: ==============================================                                            MENU =============================================== 1. Add student records 2. Delete student records 3. Update student records 4. View all student records 5. Calculate...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • Programming 5_1: Create a Java class named <YourName>5_1 In this class create a main method...

    Programming 5_1: Create a Java class named <YourName>5_1 In this class create a main method, but for now leave it empty. Then write a Java method getAverage which takes an array of integers as it’s argument. The method calculate the average of all the elements in the array, and returns that average. The method should work for an array of integers of any length greater than or equal to one. The method signature is shown below: public static double getAverage(...

  • please use java do what u can 1. Modify the Student class presented to you as...

    please use java do what u can 1. Modify the Student class presented to you as follows. Each student object should also contain the scores for three tests. Provide a constructor that sets all instance values based on parameter values. Overload the constructor such that each test score is assumed to be initially zero. Provide a method called set Test Score that accepts two parameters: the test number (1 through 3) and the score. Also provide a method called get...

  • QUESTION 3 A teacher sees students straggling into her class at highly diverse times. She secretly...

    QUESTION 3 A teacher sees students straggling into her class at highly diverse times. She secretly records when each person comes into her class. Everyone in the class at the bell gets a score of zero. Then, as each late person comes in, the number of seconds after the bell that the person arrives is recorded. Number of seconds late, then, is each person's individual score. The scores ranged from 0 to 600 (for people who were 10 minutes late)....

  • Write a class called Student. The specification for a Student is: Three Instance fields name -...

    Write a class called Student. The specification for a Student is: Three Instance fields name - a String of the student's full name totalQuizScore - double numQuizesTaken - int Constructor Default construtor that sets the instance fields to a default value Parameterized constructor that sets the name instance field to a parameter value and set the other instance fields to a default value. Methods setName - sets or changes the student name by taking in a parameter getName - returns...

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
ADVERTISEMENT