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

Write an exception class named InvalidTestScore. Modify the TestScores class you wrote in Part I so that it throws an InvalidTes

tScore exception if any of the test scores in the array are invalid. Test your exception in a program (in a subclass located in the same file). Your program should prompt the user to enter the number of test scores, and then ask for each test score individually. Then, it should print the average of test scores. If the average method throws an InvalidTestScore exception, the main method should catch it and print "Invalid test score."
Computers and Technology
1 answer:
Elan Coil [88]3 years ago
8 0

Answer:

See Explaination

Explanation:

package testscores;

import java.util.ArrayList;

import java.util.List;

public class TestScores {

public List<Integer> scorearray=new ArrayList<>();

public TestScores(List<Integer> scores) throws InvalidTestScore{

this.scorearray=scores;

for(int i=0;i<scorearray.size();i++){

if(scorearray.get(i)>100 || scorearray.get(i)<0){

throw new InvalidTestScore(this.scorearray.get(i));

}

}

}

public double average(){

int tot=0;

for(int i=0;i<this.scorearray.size();i++){

tot=tot+this.scorearray.get(i);

}

return tot*(1.0)/(this.scorearray.size());

}

class InvalidTestScore extends Exception

{

private double amount;

public InvalidTestScore(int Score)

{

System.out.println("Invalid Score "+Score);

}

}

}

You might be interested in
Which app or website teaches java and phyton
aev [14]

Microsoft is a website that teaches java and phyton

6 0
3 years ago
Henry has to create software that manages a database of all his clients of his firm. He wishes to run software on another comput
soldi70 [24.7K]

Answer:

The answer is B.

Explanation:

8 0
3 years ago
Read 2 more answers
People of brainly Just a quick warning that there is a group of people posting links with virus.
valina [46]

Answer:

Thank you, they post on EVERY. SINGLE. QUESTION.

Explanation:

They keep posting the same file every time, but they might change the file after seeing this post. Please just don't click any files!

7 0
3 years ago
Read 2 more answers
The SQL SELECT built-in function COUNT ____.
tia_tia [17]

The SQL SELECT built-in function COUNT none of the above options.

<h3>What is a SELECT query?</h3>

A select query is known to be a kind of a database object that depicts the information that is shown in Datasheet view.

Note that A query does not save data, it shows data that is saved in tables.  The SELECT statement is known to be one that is often used to select data from what we call a database.

Hence, The data returned is said to be saved in a result table, known to be the result-set.

Based on the above, the SQL SELECT built-in function COUNT none of the above options.

Learn more about  SQL SELECT from

brainly.com/question/10097523

#SPJ1

5 0
2 years ago
What is the maximum number of columns in a spreadsheet that you can sort in one instance in software like OpenOffice Calc?
MakcuM [25]
The correct answer is D
6 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
    6·1 answer
  • There are about what licensed drivers here in Florida
    7·1 answer
  • A _____ captures the pattern in a _____ and sends it to the computer, where special software translates the _____ into meaningfu
    8·1 answer
  • When powering off your computer is best down using?
    8·2 answers
  • epic poem - long narrative poem about heroic deeds about pharrell williams of the happy song please help i need the right answer
    11·1 answer
  • Using 2 bytes, how many different characters can Unicode represent?
    14·1 answer
  • Dedicated server hosting and dedicated web dedicated is the same ??????
    14·1 answer
  • What is a characteristic of maintaining logs in a system? A. Logging prevents security violations, but only deals with passive m
    10·1 answer
  • **HELP ME PLS**
    15·1 answer
  • What is the value of six sigma ? How dose it relate to agile management
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!