Even complicated and confusing topics will be easily developed and covered if you request our help writing an essay. Place an order today!

 

Errors occur in programs, and there are two ways to address the problems. The first is to try to write code that checks for errors and then deals with them. For example, you can use error checking to see if a user selected a valid menu option after making a selection. Error checking tries to prevent errors from occurring. Another method is to go ahead and let errors occur but to handle them gracefully before they can affect the operation of the program. This method, called exception handling, will be the focus of this project.

For this project, you will write a Java program that demonstrates exception handling. Your program will accept from the user ten values and place those numbers in an array. The numbers in the array will be added together and the result displayed to the user. The program will also perform division. The program should compare the values for elements 1 and 2 in the array and divide the larger number by the smaller number. It should compare the values for all odd/even elements and divide the larger by the smaller value. The program should use exception handling to avoid division by zero errors or out of range errors (dictated by the variable’s data type) which would cause the program to stop due to the error. The program should prompt the user for a second set of ten numbers. When the user enters 9999 the program should terminate normally.

For this project, do the following:

  • Create a new project in your IDE named "ExceptionHandler."
  • Write code to accept numbers as described above from the user. Your code should ensure that only numbers are accepted.
  • Write code to add all values together and to divide larger numbers by smaller numbers in odd/even elements. Results should be displayed. Loop to get another set of ten numbers from the user until the user enters 9999 as the first number.
  • Use exception handling to handle division by zero and out of range exceptions.
  • In the catch blocks, be sure to display the cause of the exception to the user.
  • Make sure your exception handler will handle any other errors as a default.
  • Create a UML activity diagram that illustrates how your program works. Your diagram must include all the data items in your program.
  • Use good comments to describe how the program works.
  • Make sure the program runs correctly before submission.
  • Prepare a Word document, and upload it to the course portal.

testimonials icon
What is moral distress? Provide an example from your nursing practice (excluding names and identifying details). Was there a solution from your...
testimonials icon
Question 1: Compare the wines sales and tourist bookings for each year by using appropriate method.(Mean,Media...
testimonials icon
QUESTION 1=Please respond to the following: Picture yourself working in the field o...
testimonials icon
Study Applications For your Study Applications assignment, you will apply learnings from the course as w...
testimonials icon
An examination of the history of probation and parole reveals many changes in the way this country has managed its criminal offenders. As we’ve s...
testimonials icon
you have to do research on the topic and pick 4 subjects and write about the subjects. For exampleyou can do research on...
testimonials icon
 Discussion subject  to write an initial post on any of the FEMA guidelines of physical security. Please pick one and give a  description about...

Other samples, services and questions:

Calculate Price

When you use PaperHelp, you save one valuable — TIME

You can spend it for more important things than paper writing.

Approx. price
$65
Order a paper. Study better. Sleep tight. Calculate Price!
Created with Sketch.
Calculate Price
Approx. price
$65