I need these questions in 20 minutes!!!
1. (TCO 8) Your program is running without an error, but produces strange results when the user clicks a button Calculate. You suspect that you have made a logical error in a method that defines action for this button. Explain how you would set up watch variables. (Points : 11)
2. (TCO 4) Why are exceptions particularly appropriate for dealing with errors produced by methods of classes in the Java API?
3. (TCO 4) Give an example of an if-else statement. Give an example of a switch-case statement. Explain when using a switch-case would be more appropriate than using an if-else and vice versa.
4. (TCO 6) You have in your program an ArrayList that contains student names (strings) in arbitrary order. You need to display the names ordered alphabetically. 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.
5. (TCO 5) Suppose that you have an array of product prices (type double) called prices. The values in the array are ordered from smallest to largest. You need to find the average product price, and how many prices are less or equal to the average, and how many are greater than the average. Write code fragment to accomplish it, or at the very least detailed plan (pseudocode).
6. (TCO 3) Suppose that you're developing a Java program that uses decimal numbers and you'd like to control the formatting of your program output. How do you do this using the Java library in the [login to view URL] package? List a coding example and explain the necessary steps.
7. (TCO 1) Class and object are the building blocks of Object-Oriented programming languages. What are some of the key characteristics of an object?
Suppose that you have an array of
student scores (type double) 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).
Suppose you had to create an
algorithm that choose between several different processing paths, and
the control variable was a discrete data type. What would the best
approach be?