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
ELEN [110]
3 years ago
5

Write an application that displays a series of at least five student ID numbers (that you have stored in an array) and asks the

user to enter a numeric test score for the student. Create a ScoreException class, and throw a ScoreException for the class if the user does not enter a valid score (less than or equal to 100). Catch the ScoreException, display the message Score over 100, and then store a 0 for the student’s score. At the end of the application, display all the student IDs and scores. g
Computers and Technology
1 answer:
babymother [125]3 years ago
8 0

Answer:

See explaination for the program code

Explanation:

// ScoreException.java

class ScoreException extends Exception

{

ScoreException(String msg)

{

super(msg);

}

}

// TestScore.java

import java.util.Scanner;

public class TestScore

{

public static void main(String args[]) throws ScoreException

{

Scanner sc = new Scanner(System.in);

int studentId[] = { 1201, 1202, 1203, 1204, 1205 };

int scores[] = new int[5];

int score = 0;

for(int i = 0; i < studentId.length; i++)

{

try

{

System.out.print("Enter a numeric test score for the student"+(i+1)+" of Id "+studentId[i]+" : ");

score = sc.nextInt();

if(score < 0 || score > 100)

{

scores[i] = 0;

throw new ScoreException("Input should be between 1 and 100");

}

else

{

scores[i] = score;

}

}

catch(ScoreException ex)

{

System.out.println("\n"+ex.getMessage()+"\n");

}

}

//displaying student details

System.out.println("\n\nStudent Id \t Score ");

System.out.println("=============================");

for(int i = 0; i < studentId.length; i++)

{

System.out.println(studentId[i]+"\t\t"+scores[i]);

}

}

}

You might be interested in
New trends, tools, and languages emerge in the field of web technology every day. Discuss the advantages of these trends, tools,
ikadub [295]

Answer:

Explanation:However, with the emergence of several new web development technologies, tools, frameworks, and languages in the last few years, it has now become quite .

7 0
3 years ago
The /tmp directory is a temporary directory and will not exist on a system at all times. True or False?
jeka94

Answer:

False.

Explanation:

The /tmp directory is a directory that contains files that are required temporarily and also for temporary storage of data.The data inside the /tmp directory gets deleted when the system boots or shuts down.Since the directory exists permanently the content inside it is temporary.

So we can conclude that the answer is False.

5 0
3 years ago
Will give Brainiest and stuff to right answer[s].
Aneli [31]
#22 is 1s and 0s, hope that helps a little bit
6 0
3 years ago
Read 2 more answers
What is the part of a file, the .pptx, or .txt etc called?
Lunna [17]
It is called the file extension or filename extension. It is a suffix that indicates the file format.
7 0
3 years ago
Read 2 more answers
How does a hard drive work
svetlana [45]
A small hard drive typically has only one platter, but each side of it has a magnetic coating. Bigger drives have a series of platters stacked on a central spindle, with a small gap in between them. The platters rotate at up to 10,000 revolutions per minute so the read-write heads can access any part of them.
7 0
3 years ago
Other questions:
  • 1. What arguments can you make for the idea of a single language for all programming domains
    10·1 answer
  • Which wireless technology has a typical transfer rate of 1 Mbps to 3 Mbps at distances up to about 10 meters?
    7·1 answer
  • How do optical discs store data? select one:
    15·1 answer
  • You are an IT technician at your company. The company has two small offices in different cities. The company's head office conta
    5·1 answer
  • Over the past year alone, more than _________ have been stolen from Target.
    10·2 answers
  • Please give me correct answer<br><br>please give me very short answer​
    13·1 answer
  • Firestick optimizing system storage and applications
    14·1 answer
  • How to transfer bookmarks to new computer
    15·1 answer
  • 9.2 lesson practice ​
    6·1 answer
  • Enabling encryption of all data on a desktop or laptop computer is generally considered:______.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!