1.To write a java program, with a class named Multiply and add main() within the class. The Multiply class is going to multiply two numbers together that are input by using the command-line arguments. 2. Within main(), declare a try block that parses the first two command-line arguments into ints by using the Integerparse Int() method. 3. Your try block is going to have two catch blocks, one for an Array-IndexOutOfBoundsException and one for a Number Format Exception. 4. If an Array Index Out Of Bounds Exception occurs, the user has not input two command-line arguments. Inform the user of this, print the stack trace, and have main() end using a return statement. 5. If a Number Format Exception occurs, the user has input invalid command-line arguments. Inform the user that the program expects two ints; then print the stack trace and have main() end. 6. If no exception occurs, print out the two ints and also their product. 7. Save, compile, and run the Multiply program several times by using the following command lines: java Multiply 10 5 java Multiply 10 java Multiply 7 hello

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Task 3

1.To write a java program, with a class named Multiply and add main() within the class. The Multiply class is going to multiply two numbers together that are input by using the command-line arguments.

2. Within main(), declare a try block that parses the first two command-line arguments into ints by using the Integerparse Int() method.

3. Your try block is going to have two catch blocks, one for an Array-IndexOutOfBoundsException and one for a Number Format Exception.

4. If an Array Index Out Of Bounds Exception occurs, the user has not input two command-line arguments. Inform the user of this, print the stack trace, and have main() end using a return statement.

5. If a Number Format Exception occurs, the user has input invalid command-line arguments. Inform the user that the program expects two ints; then print the stack trace and have main() end.

6. If no exception occurs, print out the two ints and also their product.

7. Save, compile, and run the Multiply program several times by using the following command lines:

java Multiply 10 5

java Multiply 10

java Multiply 7 hello

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 8 images

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education