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
alukav5142 [94]
4 years ago
5

Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the

process method may throw one of several exceptions. One of these is NumberFormatException, another is FileNotFoundException. And there are others. Write some code that invokes the process method provided by the object associated with processor and arranges matters so that if a NumberFormatException is thrown, the message "Bad Data" is printed to standard output, and if FileNotFoundException. is thrown, the message "Data File Missing" is printed to standard output. If some other Exception is thrown, its associated message is printed out to standard output.
Computers and Technology
1 answer:
jenyasd209 [6]4 years ago
4 0

Answer:

try {        

processor.process();

} catch (NumberFormatException nfe) {  

System.out.println("Bad Data");

} catch (FileNotFoundException fnfe) {

System.out.println("Data File Missing");

} catch (Exception ex) {

System.out.println(ex.getMessage());

}                            

Explanation:

The first statement invokes the process() method. Here process() is the method name and processor is the name of the object.  

try catch statement here is used to catch given exceptions in different catch blocks. When any of these exceptions occur in try block, the corresponding catch block is executed. This catch block is used to handle that particular exception.

In the above chunk of code, if the exception NumberFormatException  is thrown then the message "Bad Data" is displayed in output. The System.out.println() is used to display the message on the output screen. Similarly when the exception FileNotFoundException is thrown  the message "Data File Missing" is printed. The last catch Exception is used when any other exception is thrown and the getMessage() method is called to get the associated message and System.out.println here is used to print that associated message according to the thrown exception.

You might be interested in
Need answer ASAP !!!!!
timofeeve [1]
It’s the third one I had the same question so it’s the third one
7 0
4 years ago
Realizar una lista de las herramientas manuales que se utilizan en carpintería y otra en herrería, dibuja cada una de ellas y ex
alisha [4.7K]

Answer:

En carpintería se utilizan martillo, cinta métrica, escuadras, niveles de burbuja, navaja, herramientas de marcado, destornilladores y sierra circular.

Explicación:

Las herramientas manuales utilizadas en carpintería son martillos, cinta métrica, escuadras, niveles de burbuja, navaja, herramientas de marcado, destornilladores y sierras circulares, etc. Con martillos se pueden unir dos piezas de madera. La cinta métrica se utiliza para medir. Las herramientas manuales que se utilizan para la herrería son martillos de mano, mazos, cinceles, punzones, punzones y una selección de tenazas con brocas, etc. Estas herramientas se utilizan para cambiar la forma después de estar blandas debido al calentamiento.

4 0
3 years ago
The audience for a web banner would be
DENIUS [597]

Answer:

there are many answers for this question, it could be talking about having a web banner made, in that case, the audience would be online businesses, media pages on you tube or other websites, and advertisers, but the audience for viewing one is anyone who visits the web page, so it would the audience would be the the audience of the website

Explanation:

6 0
3 years ago
What must devices that communicate with one another on the internet have in common?
Tomtit [17]

The most devices that communicate with one another on the internet have in common is Use the identical net protocols. Website IP addresses together with 74.125. 65.91 and 72.21.

<h3>What is the IP Address?</h3>

Every tool that communicates on the Internet, whether or not or not it's a non-public computer, a tablet, a smartphone, or something else, is assigned a completely unique figuring out range known as an IP (Internet Protocol) address.

Using the Internet, computer systems join and speak with one another, usually the usage of the TCP/IP (Transmission Control Protocol / Internet Protocol).

Read more about the internet :

brainly.com/question/1538272

#SPJ4

6 0
3 years ago
write a function interest() that takes one input, a floating-point interest rate (e.g., 0.06, which corresponds to a 6% interest
Novay_Z [31]

Code:

def interest():

   interest_rate = 0.06

   investment = input(int('Investment: '))

   yield = 0

   year = 0

   while (yield < investment):

       year += 1

       yield  = investment * interest_rate

   print (year)

NOTE: i wrote this code assuming that the investment for the next year is the same as the first year and so forth

8 0
3 years ago
Other questions:
  • A team is building an application that must persist and index JSON files in a highly-available data store. Latency of data acces
    10·1 answer
  • Given two int variables, i and j, which have been declared and initialized, and two other int variables, itemp and jtemp, which
    14·1 answer
  • How many nibbles are in 18 bytes??
    5·1 answer
  • 5255555555555+55555555555555/1111*99442
    14·2 answers
  • OSHA requirements state that employees must have eye or face protection if their work exposes them to hazards such as:
    8·1 answer
  • An ellipse (three dots) following a menu item indicates that
    7·2 answers
  • What file does a aac run under
    11·1 answer
  • Write a program in C/C++ to draw the following points: (0.0,0.0), (20.0,0.0), (20.0,20.0), (0.0,20.0) and (10.0,25.0). For this
    6·1 answer
  • ما هي طرق اختبار الخرسانة <br>​
    14·1 answer
  • Answer this pls ASAP
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!