Exceptions particularly appropriate for dealing with errors


Question 1: Why are exceptions particularly appropriate for dealing with errors produced by methods of classes in the Java API?

Question 2: You have in your program an ArrayList that contains employee salaries (double type) in arbitrary order. You need to display the employees' salaries ordered in descending order. Provide detailed steps how you plan to accomplish this task. You do not need to give correct Java code (a detailed pseudocode is sufficient) but indicate which method(s) and which Java class(es) you would use.

Question 3: Suppose that you have an array of baseball scores (type integer) called Scores. The values in the array are ordered from largest to smallest. You need to find the average score, and how many scores are less or equal to the average, and how many are greater than the average. Write a code fragment to accomplish it, or at the very least write a detailed plan (pseudocode).

Question 4: Do we need to format our program output? Does formatting only apply to numeric values? What about percent values and currencies? Give an example that uses the NumberFormat class in the java.text package that formats numbers.

Question 5: Classes are the blueprints of objects. What kinds of relationships exist among classes? Explain these relationships using some appropriate real-world examples.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Exceptions particularly appropriate for dealing with errors
Reference No:- TGS0537749

Expected delivery within 24 Hours