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
To determine the type of power in use and to determine battery state or charge on a laptop, you ________.: course hero
Kryger [21]
<span> Hover the mouse over the power icon in the notifcation area</span>
3 0
3 years ago
Because its radio waves can pass through walls or desktops,
jeka57 [31]
Bluetooth i believe, not too sure however but its ur best bet
5 0
2 years ago
A ____ dynamic volume can only be created with three or more dynamic disks. raid 1 raid 5 raid 5i raid 23
aev [14]
The answer is Raid 5 and 23
8 0
3 years ago
What is the full form of GUI​
Nonamiya [84]

Answer:

The graphical user interface (GUI /dʒiːjuːˈaɪ/ jee-you-eye or /ˈɡuːi/) is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces, typed command labels or text navigation.

4 0
2 years ago
Read 2 more answers
Which interface element of a presentation program will enable Ben to see the slide number, design template, and the page style o
kicyunya [14]

B menu bar is correct.

7 0
3 years ago
Read 2 more answers
Other questions:
  • A resistor bank is connected to a controller with conductor insulation rated 75 °C. The resistors are not used in conjunction wi
    15·1 answer
  • Difference between change management n asset management
    11·1 answer
  • Write on the importance of Computer application to statistics​
    6·1 answer
  • Sabian que hay una violadora sexuar el nombre de usario es SASHENKAFASION me acaba de decir que hackio en donde vivo,mi nombre c
    5·1 answer
  • Alice and Bob decide to communicate using NTRUEncrypt with parameters (N, p, q) = (7, 3, 29). Alice’s public key is h(x) = 3 + 1
    15·1 answer
  • How are special characters added to a Word document? Check all that apply.
    6·2 answers
  • What does Al stand for?
    10·1 answer
  • SOMEONE HELP PLEASE ​
    5·1 answer
  • Which of the following are picture adjustments that can be made to images?
    12·2 answers
  • If you added the formula =SUM(B1:B5) to a spreadsheet, what would it do?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!