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
The correct or acceptable way of communicating on the internet is known as
stepladder [879]
I want to say e-mail.

8 0
3 years ago
Lean production systems are sometimes referred to as pull systems because demand from customers activates the production actions
fredd [130]

Answer:

a.Kanban Pull System

Explanation:

Part of a lean manufacturing technique, is the pull system and it is a production or service oriented process used to reduce waste. A pull system is a Lean technique for reducing the waste of any production process. Using a pull system allows you to begin new work only when there is either customer demand for it or goods are required by the next step within the production process. Applying a pull system allows you to start new work only when there is a customer demand for it. This gives you the opportunity to reduce overhead and optimize storage costs.

Kanban is based on a set of principles and practices that are easy to understand. Implementing them is also fairly simple since you do not need to make any serious changes to your existing process. But it is key that you understand the methodology and stick with the core practices if you want to successfully implement a Kanban pull system.

7 0
3 years ago
Read 2 more answers
A broadcast network is one in which a transmission from anyone attached station is received by all other attached stations over
malfutka [58]

Network layer is third layer of seven layers in the network technology. In network layer and physical data transmission been made through Ethernet or wireless, which Is connected to router and connect to other workstation or desktop or laptop.

<u>Explanation:</u>

On network layer connection is established, on success connection next layer is transport layer it is fourth layer of server layers.

Following error detection can be occurred

1. Accessing folder

2. Sometime immediate conflict  on tcpip address

3. Sometime subnet mask different

4. Host different

5. Ping to workstation on tablet or laptops  some dropping the packets

Transport layer always successful as end to end communication.

5 0
3 years ago
Explain how you would center the title" ESAYSURF" across the columns use the spread sheet
kari74 [83]
After you type the words in. press the column its in an highlight it to whatever your instructions say then press merge and center.
6 0
3 years ago
What is the function of primary keys?
Andrew [12]

Answer:

Searching and sorting.

Explanation:

A data dictionary can be defined as a centralized collection of information on a specific data such as attributes, names, fields and definitions that are being used in a computer database system.

In a data dictionary, data elements are combined into records, which are meaningful combinations of data elements that are included in data flows or retained in data stores. This ultimately implies that, a data dictionary found in a computer database system typically contains the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. This records are stored and communicated to other data when required or needed.

Basically, when a database management system (DBMS) receives data update requests from application programs, it simply instructs the operating system installed on a server to provide the requested data or informations.

Binary search is an efficient algorithm used to find an item from a sorted list of items by using the run-time complexity of Ο(log n), where n is total number of elements.

Binary search applies the principles of divide and conquer.

A primary key refers to a keyword found in a relational database which uniquely identifies each record contained therein.

A relational database can be defined as a type of database that is structured in a manner that there exists a relationship between its elements. Also, in a relational database, a single space within a row or column contains exactly one value.

Hence, the function of primary keys is that, primary keys facilitates searching and sorting because they act as unique identifiers.

8 0
2 years ago
Other questions:
  • Variable names may contain spaces and punctuation symbols. True False
    15·1 answer
  • A drop-down menu must be contained by
    5·1 answer
  • Lucy wants to develop a web page to display her profile. She wants to just start with a basic page that lists her accomplishment
    13·1 answer
  • Please Help!!!<br> I keep getting this answer wrong
    10·1 answer
  • PLEASE HELP ANSWER THIS only if you know BOTH ANSWERS!
    9·2 answers
  • Csc105 final graded project
    9·1 answer
  • Miguel owns a tile business. He has two employees who work in a small office. One answers phones and schedules appointments. Ano
    11·2 answers
  • Fill in the blanks to complete a summary of this part of the passage. For the power of Patents
    6·2 answers
  • How do I go to files in Brainly I need help
    13·1 answer
  • Which of the following are responsibilities of information security management? Defining the protection required for systems and
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!