Question: post solution and explanation as an image or snippet if possible (a) Write an unchecked exception class WeirdInputException. The class has two public constructors: one

 post solution and explanation as an image or snippet if possible

post solution and explanation as an image or snippet if possible

(a) Write an unchecked exception class WeirdInputException. The class has two public constructors: one that does not take any parameters, and one that takes a parameter of type String. Both constructors are supposed to call the respective corresponding superclass constructor for their parameters. (b) Write a static Java method without any parameters that reads a series of numbers of type int from the keyboard. - Before each input, the method prints a message to ask the user for a number. - If an input is not an int number, the method throws a WeirdinputException. - If the user enters 0 , the method finishes. - Otherwise: - if the current number is the same as the previous number, "Same" is printed; - if the current number is greater than the previous one, "Up" is printed; - if the current number is less than the previous one, "Down" is printed. - The method makes no response at all to the very first number. For example, the output for the inputs 9,8,8,5,10,10,0 would be Down, Same, Down, Up, Same (comparing, in turn, 9 and 8, 8 and 8,8 and 5, 5 and 10, 10 and 10 ). The dialogue with the user would look as follows: Enter the next number ( 0 to finish): 9 Enter the next number ( 0 to finish): 8 Down Enter the next number ( 0 to finish): 8 Same Enter the next number ( 0 to finish): 5 Down Enter the next number ( 0 to finish): 10 Up Enter the next number ( 0 to finish): 10 Same Enter the next number ( 0 to finish): 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!