Create three exception classes named numberhighexception

Assignment Help Programming Languages
Reference no: EM131308511

Assignment Instructions

Exception Handling

First, create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be directly subclassed from the Exception class, but NumberNegativeException should be subclassed from NumberLowException. You can use the BadDataException class that was defined in this module as the model for your exception classes.

Next create a class called Verify that will be used to validate that a number is within a specified range. It should have one constructor that has two int parameters. The first parameter is the minimum number in the range, and the second parameter is the maximum number in the range.

In addition to the constructor, the Verify class should have one method that is named validate. The validate method should have a single parameter of data type int. The parameter contains the number that is being validated. If the value of the parameter is less than zero, the method should throw a NumberNegativeException. If the value is less than the minimum value of the range, it should throw a NumberLowException. If the value is greater than the maximum value of the range, it should throw a NumberHighException. If the value is within the specified range, no exception should be thrown.

Once all of these classes are created, create the driver class called Program5. The driver class should instantiate a Verify object with a range of 10 to 100. It should then do the following:

Prompt the user to input a number within the specified range.

Use a Scanner to read the user input as an int. You can ensure that an int was entered because the nextInt method throws an InputMismatchException if any non-digits are entered.

Call the validate method to validate that the number is within the range.

Print an appropriate error message if the value is not within the range, or print the value if it is within the range.

You may use any Java IDE you choose to develop your source code, compile and link your code, and execute your program (jGRASP is recommended). Or you may use the Windows Command Prompt.

You are to submit the following deliverables in a single Microsoft Word file in this order, and clearly labeled:

A screen snapshot of your Java source code (all file(s) shown separately) displayed in the IDE or Windows editor showing a successful compilation, if possible (only the beginning of the source file(s) are necessary).

A listing of your entire source code file(s).

A screen snapshot of all of your program's outputs for the specified values shown in the five Input/Ouput screens. Failure to show any of them will result in lost points.

Your instructor may compile and run your program to verify its correctness.

You will be evaluated on (in order of importance):

Following directions, and the completeness and packaging of all deliverables.

Correct execution of your program (this includes proper compilation). This also includes getting the correct answers!

Proper commenting of your Java code and indentation (as specified in the text).

Neatness in packaging of your deliverables (to include putting the items in the correct order, as specified above).

Reference no: EM131308511

Questions Cloud

What is the acknowledgment number : The control field in a TCP segment is 6 bits. We can have 64 different combinations of bits. List some combinations that you think are normally used.
Address fraud detection in the new it system : Create a policy/procedure that address fraud detection in the new IT system. Address what needs to be reviewed, who should perform the review, and how often the review should be done.
Explain the importance of financial information : Explain the importance of financial information in a healthcare organization. Who are the stakeholders in the organization that need financial information and how is it used? Provide examples.
Construct an xml document : Two different ways of specifying complex types, one is defined inside the element, the other is defining a complex type first, then (re-)use it as a type of an element; Pick up one xml schema, construct an xml document
Create three exception classes named numberhighexception : Create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be directly subclassed from the Exception class
Importance of healthcare operations management : Discuss the importance of healthcare operations management. Explain how the healthcare industry differs from other industries with operations and how payers impact the revenues.
Provide discussion of the relative effectiveness of research : Provide a discussion of the relative effectiveness of the research and how it might be improved to gain better results. MAKE SURE INCLUSION OF THE FOLLOWING...... Was there further information that would be helpful that was not found?
Use of time communicate status-personality characteristics : What is the difference between denotative and connotative meanings? What words can you think of that have different denotative and connotative meanings? Have you ever been confused about whether it would be appropriate to interpret a word based on it..
What is your analysis on this from a legal perspective : What is your analysis of why our society resists bringing these people to justice particularly when their actions have been so damaging to such large numbers of the general public in our country and around the world.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write templates for the two functions minimum and maximum

Write templates for the two functions minimum and maximum. The minimum function should accept two arguments and return the value of the argument that is the lesser of the two.

  List the details of employee in database table

List the name, city, state, and phone number of each customer not located in Washington (state). Organize the list alphabetized by state and city within each state. Within each city, order the customer names alphabetically with last name followed by ..

  Use the watchdog in its default position

Use the watchdog in its default position (must be petted in less than 32 ms). Generate a 275 Hz, 50% duty cycle on P9.7. Use a timer with the SMCLK.

  Write a little man program that adds a column of input value

Write a Little Man program that adds a column of input values and produces the sum as output. An input value of zero will indicate the last value in the input stream of input values.

  Develop a concentration game

Concentration, also known as Shinkei-suijaku, Memory, Pelmanism, Pexeso or simply Pairs, is a card game in which all of the cards are laid face down on a surface and two cards are flipped face up over each turn.

  Extend the user management

Extend the user management so that user can be stored in database - user can be administrator and he can access that admin page

  Write down a macro which writes the single character

Write down a macro named putChar which writes the single character, passed a macro argument, to standard output in assemble language.

  Build a program for a shopping plazz

Build a program for a shopping plaza. Shopping store which allows its customers to shop in its showrooms. Peter england, levis, and kids kemp and finally generate the bill amount to be paid

  Give a pseudo-code description

Give a pseudo-code description of the o(n)- time algorithm for computing the power function P(x,n). Also draw the recursion trace of this algorithm for computation of p(2,5)

  Create the program for iteration control structure

Iteration Control Structure create the program which models worm's behavior - Worm can enter apple when it is in body length of apple.

  Framework of the program

Write a program to read in up to 100 positive real values from a data file that everyone will name "p4data.dat" , output them in ascending order , calculate and print the average , the median , the variance , and the standard deviation . The..

  Accuracy and completeness of computations

Analysis right and you have to develop a plausible argument to "prove" that your analysis is correct

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd