Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Project 11 Exercise2.java: SPRING 2018 CS-401 PROJECT# 11: EXTENDING THE EXCEPTION CLASS This assignment is a re-make of Lab#11s Exercise #2 This time when the
Project 11
SPRING 2018 CS-401 PROJECT# 11: EXTENDING THE EXCEPTION CLASS This assignment is a re-make of Lab#11s Exercise #2 This time when the user enters an int that is Java legal but out of the 1..100 range, you will manually throw an Exception of type Exception. This type is not a built in Java Exception type. This is a type (a new class) that you will write by extending the built in Exception type. There are 3 possible Exceptions that the.nextInt method can throw o InputMismatchException-if the next token does not match the Integer regular expression, or is out of range o NoSuchElementException -if input is exhausted DONT WRITE A CATCH BLOCK FOR THIS o IllegalStateException if the scanner is closed DONT WRITE A CATCH BLOCK FOR THIS You do not have to code up catch blocks for the last two cases because the given code should not trigger these cases. Just let the general Exception case at the bottom of your stack catch these and any other unexpected errors. You should write the following blocks pronpt usez s Systen ange1.109 print the thank yu ge Below main you NumberOutOfRangeException that extends Exception. In this class you will overwrite the default constructor such that it prints Number out of range. Must be in 1..100 must write your new Expection class named The behavior and output of your Project 11 solution will be identical in appearance to your Exercise#2 solution from Lab#11 The difference be in how it is written. If a user were to run your Lab# 11 Exercise#2 solution and then run your Project #11 solution, they should not be able to detect any diffence in appearance or behavior reagardless of what inputs are fed to it by the user The difference of course is in how it is written: but by all Here is the starter file from Exercise2.java. You must rename it to: Project11.java and add a class definition (named Project #11 file. This new class will extend the general Exception class. Exception) to the bottom of the Exercise2.java:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started