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

  Sql statement that displays the isbn-title and profit

Provide a SQL statement that displays the ISBN, TITLE and PROFIT for all books where the COST is greater than or equal to $10.00 and less than or equal to $40.00. (The PROFIT is the difference between RETAIL and COST.) Include only those books tha..

  Program to display number of times name appears in file

You have read all names from the file, display number of times this name appears in file. write logic - step by step - to show code program to accomplish this task.

  Write a program that plays tic-tac-toe

Write a program that plays tic-tac-toe. The tic-tac-toe game is played on a 3 × 3 grid. The game is played by two players, who take turns. The first player marks moves with a circle, the second with a cross.

  C++ program to design a class

The class should have a constructor that accepts a nonnegative integer and uses it to initialize the Numbers object. It should have a member function print() that prints the English description of the Numbers object. Demonstrate the class by writi..

  Build web applications using ajax technologies

Develop a better understanding of building web applications using Ajax technologies and ShopOnline allows sellers to list items for selling and buyers to bid for the items based on the English Auction strategy, which is a popular strategy used in m..

  Use a switch statement to calculate a letter grade

Use a switch statement to calculate a letter grade based on a numeric average up to 100. Allow the numeric score to be entered in a text field. A Grade button will display the corresponding letter grade in a label.

  Validate the pairing of parenthesis in an expression

You are to write two programs. One will validate palindromes; the other will validate the pairing of parenthesis in an expression. These programs must both use stacks. You can write either an array based stack, or a linked list to perform these ta..

  Write down program to open file and copy file

Write down program which opens the file and copy file to another and for file there must be three columns of floating points for each column get maximum and minimum.

  Cooks selected by methods are different which one is taller

He orders the shortest man in each column to step aside and chooses the tallest of these twenty-five. The two cooks chosen by the two methods are different. Which one is taller?

  Create classes for account and savingsaccount

Create and write three classes - Account, CheckingAccount, and SavingsAccount. Have CheckingAccount and SavingsAccount inherit from Account.

  Write the constructor function makestk

Write the constructor function makestk, predicate function emptystk and mutator functions pushstk and popstk

  Develop application for company having breakdown of payroll

Develop the logic for application for company which wishes report containing breakdown of payroll by department. Input comprises each employee's name, department number.

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