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
Suppose that the five measured SampleRTT values are 106 ms, 120 ms, 140 ms, 90 ms, and 115 ms.
jeyben [28]

Answer:

a) 100.75,   103.15,    107.756,    105.536,   106.72

b) 5.06,    8,       14.061,       14.43,    12.89

Explanation:

Measured sample RTT values : 106 ms, 120 ms, 140 ms,  90 ms,  115 ms

First estimated RTT value = 100 ms

∝ = 0.125

β = 0.25

First DevRTT value = 5 ms

<u>A)   Compute the EstimatedRTT after each of these SampleRTT values is obtained,</u>

Formula for estimated RTT = ( 1 - ∝ ) . estimated RTT + ∝.sample RTT

B). <u>Compute  the DevRTT after each sample is obtained,</u>

Formula for DevRTT = ( 1 - β ) . DevRTT + β. | sample RTT - Estimated RTT |

attached below is a detailed solution

5 0
3 years ago
Write a class named GasTank containing: An instance variable named amount of type double, initialized to 0. An instance variable
telo118 [61]

Answer:

The class GasTank is defined below

All the steps are briefed in comments

public class GasTank {

// instance variable initialization

private double amount = 0;

//declaring instance variable capacitance

private double capacity;

//constructor having parameter of type double

public GasTank(double i)

{

capacity = i;

}

// addGas method for increasing gas quantity.

public void addGas(double i)

//quantity of gas increased is added to the existing amount. If it becomes more than total capacity, amount is set to capacity

{ amount += i; if(amount > capacity) amount = capacity; / amount = amount < capacity ? amount+i : capacity;/ }

//useGas method having parameter of type double

public void useGas(double i)

//the parameter given is deducted from 0 and if results less than 0, remains equal to 0

{ amount = amount < 0 ? 0 : amount - i; }

//method isEmpty

public boolean isEmpty()

//Returns true if volume is less than 0.1 else false

{ return amount < 0.1 ? true : false; }

//method isFull

public boolean isFull()

//returns true if the value of amount is greater than  0.1 else false.

{ return amount > (capacity-0.1) ? true : false; }

//method getGasLeve

public double getGasLevel()

//Returns the value of amount instance variable

{ return amount; }

//method fillUp

public double fillUp()

//returns the difference between the capacity and the amount

{ double blah = capacity - amount; amount = capacity; return blah; }

}

5 0
3 years ago
Complete the sentence about a focusing technique.
Butoxors [25]

Answer:

Subjects with a lot of <u>Visuals </u>make focusing easier

Explanation:

Visuals contents make a subject more focusing and interesting for the students. Students can learn that courses easily that have more pictorial content. It is the famous quote that "A picture is better than thousand words to understand".

4 0
4 years ago
Which file extension takes less storage space?
anyanavicka [17]

I believe the answer would be the JPEG file extension.

4 0
3 years ago
Read 2 more answers
You are the IT security administrator for a small corporate network. You would like to use Group Policy to enforce settings for
LuckyWell [14K]

Answer/Explanation:

To Complete this lab, do the following:

1. From Server Manager, select Tools > Group Policy Management.

2. Expand Forest: CorpNet.com > Domains > CorpNet.com.

3. Right-click the OU where the policy will be linked and select Create a GPO in this domain, and link it here.

4. In the Name field, enter the GPO name; then click OK.

5. Link the GPO to additional OUs as follows:

a. Right-click the next OU and select Link an Existing GPO to link the GPO to another OU.

b. Under Group Policy objects, select Workstation Settings from the list; then click OK.

c. Repeat step 5 to link additional OUs.

6. Import a security policy template as follows:

a. Expand Group Policy Objects.

b. Right-click Workstation Settings and select Edit.

c. Under Computer Configuration, expand Policies > Windows Settings.

d. Right-click Security Settings and select Import Policy.

e. Browse to the C:\Templates.

f. Select ws_sec.inf; then click Open.

Cheers

3 0
3 years ago
Other questions:
  • Name the written test a potential driver must pass and list the minimum required score to earn a learners license?
    9·1 answer
  • Variables used for output are associated with what controls on a form?​
    5·1 answer
  • Most internet connections use what transmission
    13·2 answers
  • By default, windows does not display ____________________ in windows explorer.
    8·1 answer
  • Should you configure if you want to limit access to files with certain classifications within a folder to a specific security gr
    13·1 answer
  • an IPv6 packet has a 40 byte base header, a 20 byte destination options extension header (which is not used for routing) and 200
    5·1 answer
  • A technician recently fixed a computer with several viruses and spyware programs on it and notices the Internet settings were se
    15·1 answer
  • If the executives for Office Max LLC, a chain of office supply stores, developed the chain's objectives by asking buyers and sto
    11·1 answer
  • Any computer expert to help me answer this question plz am giving brainliest
    11·1 answer
  • What is a thread? what resources does it share with other threads in the same process?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!