Create a new project in ide named exceptionhandler

Assignment Help JAVA Programming
Reference no: EM13771130

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.

Reference no: EM13771130

Questions Cloud

Discuss the major codes of ethics of the stakeholders : Discuss the major codes of ethics of the stakeholders involved in the issue and how these codes will affect the decision-making process and the final decision
Applied statistics in business and economics : What are the steps espoused by Applied Statistics in Business and Economics (or the instructor) for formal hypothesis testing? Explain why the sequence is important.
Types of on the job hazards : Defend or refute the following statement: First aid training is not an important training factor for employees. Do you believe first aid training is important? What types of on the job hazards can result in the need for first aid? Explain.
What are the prices each store will charge for hamburgers : Assume a linear town with 100 potential costumers that are uniformly distributed on a unit mile.  What are the prices each store will charge for hamburgers? What would their profits be? (b) Intuitively, would both stores be happy with their price and..
Create a new project in ide named exceptionhandler : Write code to accept numbers as described above from the user. Your code should ensure that only numbers are accepted.
Evaluation of pro forma financial statements : Assuming that the executive leadership includes several former accountants, how would the organizational goals influence the preparation and evaluation of pro forma financial statements?
Can terrorist use a toxic industrial chemical : Can terrorist use a Toxic Industrial Chemical (TIC) that is all ready here in the U.S. instead of bringing one into the country
What is your competition : What is your competition? How much should you charge for the products or service? What advice do you need and who can provide it?
Types of federal legislation : What types of federal legislation have been enacted with regards to employers and the AIDS epidemic? Describe the impact that AIDS has had on corporate America. How has it negatively impacted employers and their ability to function?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Reading in strings from a text file into an array

If I am reading in strings from a text file into an array, where do I place this file at so that CodeBlocks will find it?

  Approximate the volume of cheese in a rectangular hunk

You will create a program that will approximate the volume of cheese in a rectangular hunk of Swiss cheese. For this approximation you will assume that the holes in the Swiss cheese are of two types: spherical bubbles (all of the same size) or cyl..

  Class named stock to model a stock

Write a class named Stock to model a stock. The properties and methods of the class are shown in Figure 6.22. The metho changePercent computes the percentage of the change in the current vs. the previous closing price.

  Demonstrate the use of array or arraylist

It will calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners. The application should ask for the name of each salesperson being compared.

  1 ra row your boatprepare a world with a boat a person

1. ra row your boatprepare a world with a boat a person sitting in the boat an island and a pier located 25 meters from

  Develop the implementation file student.cpp

Required to implement the class to develop the implementation file Student.cpp that conforms to the following specifications

  Determines if the input string is a valid lock combination

Write a Java program that satisfies the given requirement - Prompts the user to input exactly nine characters, which constitute a valid lock combination.

  Button to increase or decrease the number of the balls

Simulates a bouncing ball. Extend to allow mulitple balls. You can use the +I or -I button to increase or decrease the number of the balls and use teh Suspend and Resume buttoms to freeze the balls or resume bouncing. For each ball, assign a random c..

  Working with numeric variables

Create a Java program for the following application. (it is in the second chapter of my Intro to "Java Programming" book (Murach 4th Edition)It involves1. working with numeric variables2.using the System.out object to print output to console

  Write a program in java that reads a file

Write a program in Java that reads a file of numbers of type int and outputs all the numbers to another file, but without there being any duplicate numbers.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Program that allows a user to input coordinates

In Java make a program that allows a user to input coordinates as to make a Hexagon via an array, and my professor has set the standards of: Write a class Polygon which draws a hexagon for a set of numbers given by the user.

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