Reference no: EM13166902
Enhance the ButtonViewer1 program so that it prints the date and time at which the button was clicked. Hint: System.out.println(new java.util.Date()) prints the current date and time.
Implement the ClickListener in the ButtonViewer2 program of Section 10.2.2 as a regular class (that is, not an inner class). Hint: Store a reference to the label. Add a constructor to the listener class that sets the reference.
Add error handling to the program in Section 10.3.2. If the interest rate is not a floating-point number, or if it less than 0, display an error message, using a JOption Pane (see Special Topic 2.5).
Write a graphical application simulating a bank account. Supply text fields and but- tons for depositing and withdrawing money, and for displaying the current balance in a label.
Write a graphical application describing an earthquake, as in Section 3.3. Supply a text field and button for entering the strength of the earthquake. Display the earth- quake description in a label.
Write a graphical application for computing statistics of a data set. Supply a text field and button for adding floating-point values, and display the current minimum, maximum, and average in a label.
Write an application with three labeled text fields, one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings account after the end of each year.
In the application from Exercise P10.12, replace the text area with a bar chart that shows the balance after the end of each year.
A class for counting the number of people
: Specification: A class for counting the number of people in a room. This might be used to control how many people are allowed into a club with a doorman.
|
Allows the user to specify a triangle with three mouse press
: Write a program that allows the user to specify a triangle with three mouse presses. After the first mouse press, draw a small dot. After the second mouse press, draw a line joining the first two points. After the third mouse press, draw the entir..
|
Application that simulates a cash register
: Implement a graphical application that simulates a cash register. Provide a text field for the item price and two buttons for adding the item to the sale, one for taxable items and one for nontaxable items. In a text area, display the register tap..
|
Graphics program that draws 12 strings
: Write a graphics program that draws 12 strings, one each for the 12 standard colors, besides Color.WHITE, each in its own color. Provide a class ColorNameViewer and a class ColorNameComponent.
|
Graphical application for computing statistics
: Write a graphical application for computing statistics of a data set. Supply a text field and button for adding floating-point values, and display the current minimum, maximum, and average in a label.
|
Returns the object with the largest measure
: public static Measurable maximum(Measurable[] objects)that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of
|
Reimplement the labeledpoint class of exercise
: Reimplement the LabeledPoint class of Exercise P9.12 by storing the location in a java.awt.Point object. Your toString method should invoke the toString method of the Point class.
|
Question hierarchy of section
: Add a class AnyCorrectChoiceQuestion to the question hierarchy of Section 9.1 that allows multiple correct choices. The respondent should provide any one of the cor- rect choices. The answer string should contain all of the correct choices, separa..
|
In competitive tournament
: In competitive tournaments, it is common for all the players or teams to play in a series of matches in order to determine a single winner of the entire tournament. However, a number of different tournament formats exist. Here, we will concern our..
|