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]
2 years ago
12

Test Average and Grade

Computers and Technology
1 answer:
sladkih [1.3K]2 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
true or false hardware diagnostics let you run a quick check of system hardware and can verify that most systems components are
sweet [91]

Answer:

True

Explanation:

3 0
2 years ago
The users, groups, and roles that have access to a server are called ______________________________.
ElenaW [278]

Answer:

With the Exclusive Lock, a data item can be read as well as written. Also called write lock. An exclusive lock prevents any other locker from obtaining any sort of a lock on the object. They can be owned by only one transaction at a time

Explanation:

8 0
1 year ago
Following a company on likedin is most similar to
san4es73 [151]
Liking a company on Facebook
6 0
3 years ago
Consider the following scenario below and recommend a solution.
sammy [17]

your account has enabled profile pictures for your users, you can manage all profile pictures for your account. Profile pictures are public and automatically approved when users upload an image in their settings. Using profile pictures can make it easier to see the users in your account and managing them gives you the ability to keep the pictures appropriate.

If Gravatars are enabled for an institution in account settings, and a user has a Gravatar but chooses not to upload a profile picture, the Gravatar will display for the user's profile picture.

If a student views another student's user details in a course and reports a profile picture as inappropriate, you can review those profile pictures and approve, lock, or delete the picture. In the courses, instructors can remove profile pictures completely from a user's details page.

5 0
2 years ago
Which of the following shows data conversion taking place?
PSYCHO15rus [73]

Answer:

C

data converted from double to integer.

7 0
2 years ago
Other questions:
  • Consider the following method: public static void arrayMystery(int[] array) { for (int i = 0; i &lt; array.length - 1; i++) { if
    10·1 answer
  • Match each keyboard command with its result.
    6·1 answer
  • True or false.the color attribute cannot recognized the hexadecimal code.
    7·2 answers
  • Technician A says that it's a good idea to perform a test drive before attempting repairs. Technician B says that it's a good id
    9·2 answers
  • Given the following while() loop, which statement is true assuming A,B,C,D are int variables and A &gt; B? while ( ( A &gt;= B)
    8·1 answer
  • __________ are the first line of defense against unsafe drivers.
    5·1 answer
  • What is a benefit of the rise in citizen journalism? Multiple answer choice below
    13·1 answer
  • Write a function namedmake_complex that stores its twoarguments (both of type double) in acomplex structure, then returns thestr
    12·1 answer
  • I really need help in this!!!
    11·1 answer
  • There are many potential risks associated with the internet. what do we call the distribution and access of illegal copies of di
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!