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]
4 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]4 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
The internet has provided great opportunities for fundraising. true/false
alekssr [168]
True, sites such as kickstarter and just giving are fantastic examples of such.
8 0
3 years ago
In what way(s) did the password you tried to use not meet the password policy requirements?
Gre4nikov [31]
Depends on the organization. Password policies differ between each organization. Generally on a mainstream point of view. Passwords should generally be complex. If your passcode is too short. This could pose a risk to your account and the companies data could be at risk.

Broad range of possible pass code rules that may be blocked.

7 character limit
Capital letter and/or number figure
No easy consecutive digit or character: e.g abcd1234
8 0
3 years ago
Jo.in Goo.gle meet the code/rhk-rvet-tdi​
horrorfan [7]

Answer:

nah

Explanation:

cuz ion wanna

8 0
3 years ago
What are the important role that health care workers play in documentation, confidentially, maintenance and credibility of the m
Anna007 [38]
75. Health care workers are those persons who makes sure that they documented everything about their patient’s health problem. They also makes sure that they maintain those documentations and make sure the credibility and confidentially of an individual that undergone their care. It is their responsibility that this is keep confidential based on their patient’s request and also in their job’s duty. Once a health care worker divulge any confidential information, he or she can be given by a person a case in the court.
8 0
3 years ago
What aspect do you need to keep in mind when you add images in a Word document?
MrRissso [65]
Hey there!

You would have to keep in mind that you would have first, use the correct format and make sure that the format matches the requirements for the Microsoft word doc.

I believe that they would be the following:

PDF, JPDE,TIFF, and many more that would have to be able to except the images of the files.

I hope this helps you!
6 0
3 years ago
Other questions:
  • Define the term e-learning​
    5·2 answers
  • 12.
    10·1 answer
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • Write a recursive function, displayFiles, that expects a pathname as an argument. The path name can be either the name of a file
    6·1 answer
  • One modeling technique drawn from systems analysis and design that can provide an excellent way to illustrate how a business fun
    13·1 answer
  • Robyn needs to ensure that a command she frequently uses is added to the Quick Access toolbar. This command is
    14·1 answer
  • Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6
    13·1 answer
  • Can someone answer this for me will award brainliest lol
    11·2 answers
  • How do you enter the decimal 73 into the computer?
    11·1 answer
  • Write the steps involving coping and pasting a file in a folder​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!