In a single source file named App.java, define an Employee class to encapsulate employee data and an App class defining an applet to maintain a collection of Employee objects.
Define a small, non-public class named Employee that encapsulates private instance variables for name (String) and pay rate (double). The class needs a single constructor to instantiate an Employee object with values received for both instance variables. It also needs minimal set() and get() methods (such as setName(), getPayRate(), etc.) that allow a class client to store and retrieve the value of each instance variable. Do not be concerned with editing the data within this class. It is used only to support the testing of your applet.
Code this class inside your App.java source file but after the definition of the App class. Be sure to omit the specification of public in the class header (because Java only allows one public class per source file).
This public class will define the processing of your applet. Its required features are as follows:
Name (a TextField). For entering or displaying an employee's name.
Pay rate (a TextField). For entering or displaying an employee's pay rate. When used for input, the value must be edited (see the processing notes below). If the value is invalid, display an appropriate error message.
First (a button). When clicked, triggers the display of the name and pay rate of the first employee in the collection. If the collection is empty, display an appropriate message.
Next (a button). When clicked, triggers the display of the name and pay rate of the next employee in the collection. If there are no more objects in the collection, display an appropriate message.
Find (a button). When clicked, triggers the display of the name and pay rate of the employee whose name currently appears in the name text field. If the requested employee doesn't exist, display an appropriate error message.
Add (a button). When clicked, triggers the construction of an Employee object having the currently displayed name and pay rate and the addition of the object to the collection. Display appropriate error messages if input data is missing or incorrect or if the employee already exists within the collection.
Delete (a button). When clicked, triggers the deletion of the Employee object having the currently displayed name from the collection. If the specified employee doesn't exist, display an appropriate error message.
Number of employees (a Label). For displaying how many Employee objects are currently within the collection. This must be changed as employees are added or deleted from the collection.
Message area (a TextArea). For displaying messages.
The applet must get the value of an HTML parameter named "maxRate". Convert the associated value string to a double and use it to edit a pay rate entered by the user. It represents the maximum allowable pay rate for an employee. If an attempt is made to enter a larger pay rate, display an appropriate error message.
Use GridBagLayout for the applet's components. The arrangement of components is up to you.
Use a SortedMap implemented as a TreeMap for the collection. It is to be maintained in ascending order based upon employee name.
When the user moves the mouse to touch one of the buttons, its color or font should change. When the mouse exits the button, its color or font should return to normal.
As an aid in formatting the employee's pay rate, you may use the moneyFormat() method of my Utility class. For more information, consult the documentation for my Utility class.
You are free to choose colors, fonts, and arrangement of components. Be creative, but make the applet visually appealing and easy to run.
Your program will be worth 30 points to be awarded as follows:
Accuracy (20 points). The program should correctly perform all specified processing.
Creativity (5 points). The program should be original yet simple in design.
Maintainability (5 points). The program should contain useful comments, meaningful identifiers, and be logically structured. It should contain an opening documentation block with your name and a brief description of what the program does. It should also have a block of comments preceding every major section of code.
Send your App.java source file as an e-mail document or attachment no later than midnight on the program due date. If you are using JBuilder 4 and the Test project previously copied from the College of Business network, this file will be in the src folder of the project. In the College of Business labs, the complete path of your source file is:
To verify that you are doing this properly, send a copy to yourself, copy the source code to your test project, and re-test the program. If it works for you, it will probably work for me.
Upon receipt of your e-mail, I will send either a verification message or your project score and comments (based on the above criteria). Project scores will be posted on the Internet within a few days after the due date.