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
A batholith is an example of a(n) _____ igneous rock (one of the two main igneous rock groups).
Naily [24]
A batholith is an intrusive igneous rock.
3 0
3 years ago
Read 2 more answers
Write a function, reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed. For exampl
Sedbober [7]

Answer:

This program is written in C++. You can implement this program in any language. The code along with comments is given below in explanation section.

Explanation:

#include <iostream>  

using namespace std;  

int main()  // main function

{  

int number, reverseNumber=0, reminder;  //varible declaration  

cout<<"Enter a number: ";  //prompt user to enter the number  

cin>>number;   //save the entered number into number variable  

 while(number!=0)    //while number does not become zero.... remain in loop

 {    

    reminder=number%10;    // taken reminder of number    

    reverseNumber=reverseNumber*10+reminder;   //store the number digit into reverse order  

    number/=10; //decrease the number or shift the division to next digit    

 }    

cout<<"Reversed Number: "<<reverseNumber<<endl;    //print reversed number.  

return 0;  

}  

5 0
3 years ago
AutoComplete is a feature of Excel that automatically
larisa [96]
AutoComplete automatically fills a cell entry. The correct answer is A.
6 0
3 years ago
Read 2 more answers
Match the feature to its function. 1. Normal view provide rows of icons to perform different tasks 2. Notes view an area in whic
pashok25 [27]

Answer:

Match the feature to its function.  The answers are as below:

1. Normal view the place where creating and editing occurs  

2. Notes view an area in which information for handouts can be added  

3. Slide pane the place where the slide order can be changed

4. Menu bar contains lists of commands used to create presentations  

5. toolbars provide rows of icons to perform different tasks  

Explanation:

It is the normal view where the editing and the creation of the slides occur. And it's the notes view where you can add the information for handouts. You can arrange the slides in the slide pane. And you can get a list of commands for creating the presentation in the Menu bar. Also, Toolbar is the rows of icons which helps in performing a various set of tasks. And all these are definitions and prove our above selections are correct.

6 0
3 years ago
Read 2 more answers
Code Example 4-3 main program: import arithmetic as a def main(): num1 = 5 num2 = 6 result = a.add(num1, num2) print("The sum is
melisa1 [442]

Answer:

Option B.

Explanation:

6 0
3 years ago
Other questions:
  • The definition of HTTP makes use of the ASCII character set without reference to how these characters are encoded. Explain why t
    15·2 answers
  • HELP ME PLZZ FFFAAASSSTTTT
    8·2 answers
  • Which one is not among standard creation committee?
    9·1 answer
  • Write code that inserts userItem into the output string stream itemsOSS until the user enters "Exit". Each item should be follow
    5·1 answer
  • Explain the use of keyboard shortcuts and key combinations. You are at the tenth page of a 20-page document. You need to make ch
    14·1 answer
  • How to make a Tip Calculator in code?
    12·1 answer
  • What should you do if a reporter asks you about potentially classified information on the web
    12·1 answer
  • The process where the programmer steps through each of the program's statements one by one is called
    11·1 answer
  • A piece of data in a program whose value can change is called a(n) -
    8·2 answers
  • Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject afte
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!