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
Find the ratio of 24 to 36​
miv72 [106K]

Answer:

24:36 if you want it in the smallest form it is 2:3

4 0
3 years ago
Read 2 more answers
What is typeface
Mademuasel [1]
I’m so bored and hungry answer is c 3566
4 0
3 years ago
Read 2 more answers
Electronic type is often considered to be the latest step in the evolution of the written ______________.
Allisa [31]
It isn’t people but im really confused. I think its A but dont come at me if its wrong
4 0
3 years ago
When you first launch presentation software, how many blank slides will appear on your screen?
nataly862011 [7]

one, the title slide

6 0
3 years ago
Read 2 more answers
Should you ever force a CPU into<br>its socket?​
tatyana61 [14]

Answer:

no you should not force a cpu into its socket.

Explanation: on an intel platform the pins are on the motherboard, therefore if you force it in it will damage the pins on the motherboard, and on AMD the pins are on the cpu itself so you can damage the extremely fragile pins on it, you can not shock your cpu however like the other answer.

7 0
3 years ago
Other questions:
  • To join two or more objects to make a larger whole is to _____________ them.
    11·2 answers
  • Do we have to use intersection?
    6·1 answer
  • Prompt the user for an automobile service. Each service type is composed of two strings. Output the user's input. (1 pt) Ex: Ent
    9·1 answer
  • Keyshia adds shapes with text to show the steps involved in taking the temperature of a liquid in a laboratory. She
    6·1 answer
  • Computer a has an overall cpi of 1.3 and can be run at a clock rate of 600mhz. computer b has a cpi of 2.5 and can be run at a c
    11·1 answer
  • What two optical disc drive standards support writing discs with a total capacity of 8.5gb?
    12·1 answer
  • How can rows be added to a table? Check all that apply
    13·2 answers
  • Match the metric units with these measurements
    8·1 answer
  • Software refers to the physical parts of a computer.<br> a. True<br> b. False
    11·2 answers
  • 4. Cash inflows from investing activities normally arise from all of the following EXCEPT
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!