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
Hilda is troubleshooting a problem with the encryption of data. at which layer of the osi reference model is she working?
Fittoniya [83]
The la<span>yer of the osi reference model that hilda is currently working on is: presentation
On Osi reference model, the presentation layer is created </span><span>to take care of the semantics and syntax of the information exchanged between two systems. The presentation layer will make sure that the receiver of the information will understand the data that being given.</span>
7 0
3 years ago
Google is an example of a(n):
bixtya [17]
It would B, because anytime you search it always pulls up google search engine.
8 0
3 years ago
Read 2 more answers
Evaluating sorts given the following array: 41, 32, 5, 8, 7, 50, 11 show what the array looks like after the first swap of a bub
irga5000 [103]

The way that  the array will looks like after the first swap of a bubble sort in ascending order is   {5,32,41, 8,7,50,11}.

<h3>Who do you Write sort code in JAVA?</h3>

It will be:

class SSort

{

  void sort(int array[])

  {

      int n = array.length;

      for (int i = 0; i < 2; i++)

      {

          int minimum_index = i;

          for (int j = i+1; j < n; j++)

              if (array[j] < array[minimum_index])

                  minimum_index = j;

           int temp = array[minimum_index];

          array[minimum_index] = array[i];

          array[i] = temp;

      }

  }

   void printArray(int array[])

  {

      int n = array.length;

      for (int i=0; i<n; ++i)

          System.out.print(array[i]+" ");

      System.out.println();

  }

  public static void main(String args[])

  {

      SSort s = new SSort();

      int array[] = {41, 32, 5, 8, 7, 50, 11};

      s.sort(array);

      System.out.println("After first two iteration of Selection sort:");

      s.printArray(array);

  }

}

Therefore, The way that  the array will looks like after the first swap of a bubble sort in ascending order is   {5,32,41, 8,7,50,11}.

Learn more about array  from

brainly.com/question/26104158

#SPJ1

8 0
2 years ago
Which of the following, when used in conjunction with hyperlinks, can be useful for easily navigating a Word document? : *
Valentin [98]
Caption is a best answer i hope its work
7 0
3 years ago
Question 3 / 5
Andrej [43]

Answer:

False

Explanation:

3 0
3 years ago
Other questions:
  • A car holds 16 gallons of gasoline and can travel 312 miles before refueling. Write aC++ program that calculates the number of m
    9·1 answer
  • A​ __________ is a commonly used tool for showing how the parts of a whole are distributed.
    11·1 answer
  • Write a function called median, that takes as parameter a full, sorted array of doubles and returns the median of the list. For
    15·1 answer
  • Discuss the importance of employee security awareness training. What innovative ways should company’s implement security trainin
    14·1 answer
  • A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer
    14·1 answer
  • The objective of an Enterprise Resource Planning (ERP) system is to create a customized software program that integrates the inf
    15·1 answer
  • My speaker on my phone is not working, when I try and play music and videos the sound dosen't work. However my alarm works. Can
    9·2 answers
  • Using complete sentences post a detailed response to the following.
    13·1 answer
  • Describe advantages and disadvantages for microprocessor controlled devices in the household.
    7·1 answer
  • HELP MEEE PLEASE!!!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!