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
shutvik [7]
3 years ago
10

Write a program that accepts any number of homework scores ranging in value from 0 through

Computers and Technology
1 answer:
Dimas [21]3 years ago
6 0

Answer:

This program is written in Java programming language.

It uses an array to store scores of each test.

And it also validates user input to allow only integers 0 to 10,

Because the program says the average should be calculated by excluding the highest and lowest scores, the average is calculated as follows;

Average = (Sum of all scores - highest - lowest)/(Total number of tests - 2).

The program is as follows (Take note of the comments; they serve as explanation)

import java.util.*;

public class CalcAvg

{

public static void main(String [] args)

{

 Scanner inputt = new Scanner(System.in);

 // Declare number of test as integer

 int numTest;

 numTest = 0;

 boolean  check;

  do

  {

   try

   {

     Scanner input = new Scanner(System.in);

    System.out.print("Enter number of test (1 - 10): ");

    numTest = input.nextInt();

    check = false;

    if(numTest>10 || numTest<0)

     check = true;

   }

   catch(Exception e)

    {

     check = true;

   }

  }

  while(check);

  int [] tests = new int[numTest];

//Accept Input

for(int i =0;i<numTest;i++)

{

System.out.print("Enter Test Score "+(i+1)+": ");

tests[i] = inputt.nextInt();

}

           //Determine highest

           int max = tests[0];

           for (int i = 1; i < numTest; i++)

           {

               if (tests[i] > max)

               {

                   max = tests[i];

               }

           }

           //Determine Lowest

           int least = tests[0];

           for (int i = 1; i < numTest; i++)

           {

               if (tests[i] < least)

               {

                   least = tests[i];

               }

           }

           int sum = 0;

           //Calculate total

           for(int i =0; i< numTest;i++)

           {

               sum += tests[i];

           }

           //Subtract highest and least values

           sum = sum - least - max;

           //Calculate average

           double average = sum / (numTest - 2);

           //Print Average

           System.out.println("Average = "+average);

           //Print Highest

           System.out.println("Highest = "+max);

           //Print Lowest

           System.out.print("Lowest = "+least);

}

}

//End of Program

You might be interested in
Which of the following is a type of monitor port?
Soloha48 [4]
B. all of those.

just to clarify,
HDMI is the port for monitor and sound.

VGA is for video/monitor port
and display port.... I don't know, but it's a type of monitor port.
7 0
3 years ago
Can an engine run on air? I think it can, but I am not sure
Svetlanka [38]

Hello,

NO, and engine can run on steam, gas and other things but not air.

-Bella

3 0
3 years ago
Read 2 more answers
Which function of a web page relies on responsive web design
navik [9.2K]

Answer:

Adding extra horizontal scroll, Blocking mobile devices from viewing, Eliminating extra links, Resizing content to fit a screen.

Explanation:

3 0
2 years ago
Brock wants to use several images on his hiking blog. However, the images are making his pages load very slowly. Explain to Broc
attashe74 [19]
First brock has to make sure he has all the hiking gear, like a camel back, gloves, the right pair of shoes. and then if he wants to take pictures he should buy a go-pro so he doesn't really have to move will the go-pro will record or take pictures.
hope i helped 0-0 ;p
plz mark brainly
5 0
3 years ago
Suppose there are two ISPs providing WiFi service in a café. Each ISP operates its own AP and has its own IP address block. If b
Alinara [238K]

Answer:

As a design rule, access points within range of each other should be set to channel frequencies with minimal signal overlap. Users will find that roaming doesn’t work well, and performance will degrade because of interference between access points.

Explanation:

8 0
3 years ago
Other questions:
  • Which command would you use to move a file from one location to another?
    6·2 answers
  • Conceptual note-taking is the act of
    15·1 answer
  • Systematically tackling the threats and vulnerabilities in the seven individual domains of a typical IT infrastructure helps you
    6·1 answer
  • Match the elements of a web page with their descriptions?
    15·2 answers
  • Mika forgot to put in the function name in his function header for the code below. What would be the best function header?
    12·2 answers
  • Which of the following is NOT a factor of identifying graphic design?
    10·2 answers
  • Someone please make a random question with an easy answer because i need one more brainliest to UPGRADE!
    7·2 answers
  • Write a Python function that join the two string and print it ​
    14·2 answers
  • If a TextView has not been displayed yet, it is possible to retrieve measurements about its width and height using the _________
    7·1 answer
  • If you want to stop a loop before it goes through all of its iterations, the break statement may be used. Group of answer choice
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!