1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lelechka [254]
3 years ago
12

Test Average and Grade

Computers and Technology
1 answer:
sladkih [1.3K]3 years ago
8 0

Answer:

import java.util.Scanner;

public class TestAveGrade

{

public static void main(String[] args) {

 Scanner scanner = new Scanner( System.in );

       double userScore1, userScore2, userScore3, userScore4, userScore5;

       

       System.out.print ("Enter test grade for student1:");

       userScore1 = scanner.nextDouble();

       System.out.print ("Enter test grade for student2:");

       userScore2 = scanner.nextDouble();

       System.out.print ("Enter test grade for student3:");

       userScore3 = scanner.nextDouble();

       System.out.print ("Enter test grade for student4:");

       userScore4 = scanner.nextDouble();

       System.out.print ("Enter test grade for student5:");

       userScore5 = scanner.nextDouble();

       

       System.out.println("The letter grades are as follows:");

       System.out.println("Student-1: " + determineGrade(userScore1));

       System.out.println("Student-2: " + determineGrade(userScore2));

       System.out.println("Student-3: " + determineGrade(userScore3));

       System.out.println("Student-4: " + determineGrade(userScore4));

       System.out.println("Student-5: " + determineGrade(userScore5));

           

       System.out.printf("The average grade was: %.2f", calcAverage (userScore1, userScore2, userScore3, userScore4, userScore5));

}

public static double calcAverage(double userScore1, double userScore2, double userScore3, double userScore4, double userScore5){

       double average;

       average = (userScore1 +userScore2 +userScore3 +userScore4 +userScore5) /5;

       return average;

   }

   public static String determineGrade(double testScore){

       String letterGrade = " ";

       if (testScore < 60){

           letterGrade = "F";

       }

       else if (testScore <70) {

           letterGrade = "D";

       }

       else if (testScore <80) {

           letterGrade = "C";

       }

       else if (testScore <90) {

           letterGrade = "B";

       }

       else if (testScore <100) {

           letterGrade = "A";

       }

       return letterGrade;

   }

}

Explanation:

Hi, I modified your code. Your methods work but you need to update the main.

Ask the user to enter five grades and store the values in different variables

Call the determineGrade method passing each grade as a parameter

Call the calcAverage method passing all the grades as parameter

You might be interested in
Website hosting servers have their own unique IP address, what does this address consist of?
Alchen [17]
A. Numbers and letters
4 0
3 years ago
can anyone yell how to save the python file in folder i am saving it but whenever I'm trying to open its not open​
NISA [10]

Saving a python file implies that one wants to have a physical file of the program on a storage device.

To save a python program, the following step must be followed

  1. Select Save As
  2. Navigate to the directory where you want to save the file
  3. Enter the file name
  4. Click save

Note that python files are saved in the .py extension

Read more about python programs at:

brainly.com/question/16397886

4 0
3 years ago
Read 2 more answers
The type of manager that services all requests for data is known as?
3241004551 [841]
The type of manager that services all requests for data is known as IT service management (ITSM)
8 0
3 years ago
Que problema se puede usar con el uso de las TIC ?​
raketka [301]
We do not speak English in this please translate in Google because we do not know Spanish
8 0
3 years ago
. A search engine is a way to
Sindrei [870]
<span>Option A, the search engine is the way to get information on the internet through a web browser, installed on an operating system of a computer. It is software that gathers all the information and stores it to accelerate the search for the users by entering the data of the desired information.</span>
8 0
4 years ago
Read 2 more answers
Other questions:
  • Assume that you have an array of integers named arr. The following program segment is intended to sum arr [0]through arr[n−1], w
    7·1 answer
  • What is the speed limit in school zone
    11·2 answers
  • Which option enables you to keep the last grammatical change
    15·2 answers
  • Is a ryzen 5 3600 and a gtx 1660 super a good combo? ​
    13·1 answer
  • A switch is closed, and a lamp turns on.The switch is opened, the lamp turns off. eXplain what is meant by these two statements.
    10·1 answer
  • Research shows that a passive close to a cover letter leads to more interviews. Please select the best answer from the choices p
    8·2 answers
  • Natalie is a secretary and must complete a large amount of filing this afternoon. At 1:00 PM, the office receptionist gets sick
    10·1 answer
  • Write two recursive versions of the function minInArray. The function will be given a sequence of elements and should return the
    8·1 answer
  • Advantages against its counterpart because of its portability​
    8·1 answer
  • What is contained in the Open Files section of Shared Folders? ​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!