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
bixtya [17]
3 years ago
15

7. Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grad

e for each score and the average test score. Write the following methods in the program: calcAverage: This method should accept five test scores as arguments and return the average of the scores. determineGrade: This method should accept a test score as an argument and return a letter grade for the score, based on the following grading scale: Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D Below 60 F
Computers and Technology
1 answer:
Alenkasestr [34]3 years ago
5 0

Answer:

The code solution is written in Java.

  1. import java.util.Scanner;
  2. public class TestScore {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        System.out.print("Please enter first score: ");
  6.        double firstScore = input.nextDouble();
  7.        System.out.println("Grade: " + determineGrade(firstScore));
  8.        System.out.print("Please enter second score: ");
  9.        double secondScore = input.nextDouble();
  10.        System.out.println("Grade: " + determineGrade(secondScore));
  11.        System.out.print("Please enter third score: ");
  12.        double thirdScore = input.nextDouble();
  13.        System.out.println("Grade: " + determineGrade(thirdScore));
  14.        System.out.print("Please enter fourth score: ");
  15.        double fourthScore = input.nextDouble();
  16.        System.out.println("Grade: " + determineGrade(fourthScore));
  17.        System.out.print("Please enter fifth score: ");
  18.        double fifthScore = input.nextDouble();
  19.        System.out.println("Grade: " + determineGrade(fifthScore));
  20.        System.out.println("Average score: " + calcAverage(firstScore, secondScore, thirdScore, fourthScore, fifthScore));
  21.    }
  22.    public static double calcAverage(double score1, double score2, double score3, double score4, double score5){
  23.        double average = (score1 + score2 + score3 + score4 + score5) / 5;
  24.        return average;
  25.    }
  26.    public static String determineGrade(double score){
  27.        if(score >= 90){
  28.            return "A";
  29.        }
  30.        else if(score >= 80 ){
  31.            return "B";
  32.        }
  33.        else if(score >=70){
  34.            return "C";
  35.        }
  36.        else if(score >=60){
  37.            return "D";
  38.        }
  39.        else{
  40.            return "F";
  41.        }
  42.    }
  43. }

Explanation:

Firstly, create the method, <em>calcAverage()</em>, that takes five test scores. Within the method, calculate the average and return it as output. (Line 33 - 36)

Next, create another method, <em>determineGrade()</em>, which takes only one score and return the grade based on the range of the  score. (Line 38 -54)

Once the two required methods are created, we are ready to prompt use for input five test scores using Java Scanner class. To use get user input, create a Scanner object (Line 7). Next, use getDouble() method to get an input score and assign it to variables firstScore, secondScore, thirdScore, fourthScore & fifthScore, respectively. Once a score input by user, call determineGrade() method by passing the input score as argument and immediately print out the return grade. (Line  9 - 27)

At last, call calcAverage() method by passing the first test score variables as argument and print out the returned average value. (Line 29).

You might be interested in
You are a desktop administrator for nutex corporation. Your organization uses ethernet cable to connect network resources. A use
anygoal [31]

Answer:

A. replace the network cable

Explanation:

Based on the information provided within the question it can be said that in this scenario the best option would be to replace the network cable. The network cable refers to the Ethernet cable that is connected to the individuals personal computer. This cable being faulty is most likely the reason as too why the individual is not able to connect. Since it is displaying that signals return too early it means that there is most likely information being lost in transit.

4 0
3 years ago
Will give brainlyist
In-s [12.5K]

i think its the first sentence: Mobile devices have become the main source of communication for many people around the world

if im wrong im dum ;-;

6 0
3 years ago
Read 2 more answers
If you're searching for a date and a product at the same time, you're running a _______ query. A. Complex B. Select C. Parameter
Andrews [41]

If you're searching for a date and a product at the same time, you're running a _______ query. A. Complex B. Select C. Parameter D. Range                                                                                                                                                                                                                                                         A. Complex

6 0
3 years ago
How do a tubercolosis test work?
Soloha48 [4]
The answer is If a skin or blood TB test is posittive, your doctore mau give you a chest X-ray. They will look for abnormal spots on your lungs or any changes caused by TB.
4 0
3 years ago
In the airline industry, frequent flyer programs, ticket kiosks, and e-ticketing are all examples of capabilities that are _____
crimeas [40]

Answer:

valuable; rare

Explanation:

A valuable capability is that which gives a firm some competitive advantage. Core competencies are the operational activities that a company does best. A business’s core competencies are what distinguish it from other rival companies in its industry. While Rare capabilities are capabilities that a small amount of, if any, competitors possess. Those type of capabilities that are costly or impossible to imitate.

from the above explanation we can deduce that the modern technology implementation in the airline industry has made it possible to have valuable ptograms and softwares for carring out several task which are no longer scarce to procure.

7 0
3 years ago
Other questions:
  • How many bits must be “flipped” (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase ‘a’ that’s represe
    11·1 answer
  • Lisa managed incident response for a bank. The bank has a website that’s been attacked. The attacker utilized the login screen,
    9·1 answer
  • A user calls you and says that when they try to connect to the internal website, they are prompted for authentication. The user
    14·1 answer
  • The need to strike a<br>- among work, life, family, and other responsibilities is<br>universal.​
    15·1 answer
  • Catering question<br> What is the hottest food in the world
    5·1 answer
  • HURRY!!!!!!!!!!!!!
    15·1 answer
  • Cnt115-02* which of the following is a private ip address and can't be routed across the internet?
    12·1 answer
  • In two to three sentences, describe one advanced search strategy and how it is useful.
    13·1 answer
  • How do I make someone "Brainiest". <br> First person to reply will get "Brainiest"
    8·2 answers
  • Which one is the result of the output given by a compute
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!