Java program that demonstrates exception handling

Assignment Help Operation Management
Reference no: EM132818590

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.

 Create a zip that includes your project folder and Word document, and upload it to the course portal.

Reference no: EM132818590

Questions Cloud

Inspire people to perform beyond their normal levels : What can you do to inspire people to perform beyond their normal levels? How can they be motivated? What are some of the influence tactics?
Difference between manager and leader : What is the difference between a manager and a leader? What skills do managers need today? Are these skills different from management skills of 50 years ago?
Peacekeeper associated with your selected conflict : Analyze the role of the UN as a peacekeeper associated with your selected conflict.
Analysis of organizational problem : Continue your analysis of the organizational problem and the process you will propose in your OIP by researching, collecting, and verifying further data.
Java program that demonstrates exception handling : Write a Java program that demonstrates exception handling. Your program will accept from the user ten values and place those numbers in an array.
Monitoring and evaluation : Explain the steps for setting up a good strategy-monitoring and adjustment program, as it relates to this scenario.
Supplier relationship management system : What is the value to the company and the supplier in developing and implementing a Third Party Supplier Relationship Management System
Do you think employee productivity is affected : Do you think employee productivity is affected based on the leader's behavior and the relationship with people in the in vs. out -group?
About managers being leaders and vice versa : "The two roles are the same to me." To your point about managers being leaders and vice versa, I really like Bergmann's (1999) Grass Roots Model.

Reviews

Write a Review

Operation Management Questions & Answers

  Book review - the goal

Operations Management is about a book review. Title of the book is "Goal". This book has been written by Dr. Eliyahu Goldartt. The book has been appreciated by many as one of those books which offers an insight into the operations and strategic capac..

  Operational plan in hospitality enterprise

Operational plan pertaining to a hospitality enterprise is given in detail in the solution. The operational plan is an important plan or preparation which gives guidelines regarding the role and responsibilities of each and every operation at all lev..

  Managing operations and information

Recognise the importance of a strategic approach to the development and deployment of organisational information systems. Demonstrate an understanding of the importance of databases and their integration to the organisation's overall information mana..

  A make-or-buy analysis

An analysis of the holding costs, including the appropriate annual holding cost rate.

  Evolution and contributor of operations management

Briefly explain Evolution and contributor of Operations management.

  Functions and responsibilities of an operations manager

A number of drivers of change have transformed the roles, functions and responsibilities of an operations manager over recent years. These drivers have not only been based on technological innovations but also on the need for organisations to develop..

  Compute the optimal order quantity

Compute the Optimal Order quantity of DVD players. Determine the appropriate reorder point.

  Relationship to operations practice in the organisation

Evaluate problems in operations and identify approaches to overcoming them. Critically evaluate operating plans and identify areas for improvement. Justify, implement and evaluate changes to operations in line with modern approaches.

  A make or buy analysis

Develop a report for Figi Fabricating that will address the question of whether the company should continue to purchase the part from the supplier or begin to produce the part itself.

  Prepare a staffing plan

Prepare a staffing plan showing the change of your unit from medical/surgical staffing to oncology staffing.

  Leadership styles in different organizations

Ccompare the effectiveness of different leadership styles in different organizations

  Risk management tools and models

Be able to understand the concept of risk, roles and responsibilities for risk management and risk management tools and models.

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