Project 07

 

Overview

This is a modified version of the applet created in the previous project.. In a single source file (App.java), define an enhanced Employee class that will throw various exceptions if an attempt is made to store bad data, a custom MyLabel class that encapsulates the processing of a customized Label component, and an App class defining an applet to maintain a collection of Employee objects.

 

Employee Class

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 set() and get() methods (such as setName(), getPayRate(), etc.) that allow a class client to store and retrieve the value of each instance variable. If an attempt is made to store a null name or a pay rate that is less than zero, the corresponding "set" method must throw an Exception object having an appropriate error message. To enforce these edits during construction, the class constructor should call the "set" methods and re-throw any Exception object that may be caught. 

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).

 

MyLabel Class

Define a small, non-public class named MyLabel that encapsulates a customized Label component. It should extend the Label class and implement the Runnable interface in order to be run as a thread. A MyLabel object must display text that changes its color and font at a specified interval.  The class requires a single constructor that receives a String representing the text to be displayed and an int representing the interval in milliseconds. Provide instance methods to "set" a new value for the text being displayed and the interval in milliseconds. If an attempt is made to set a null text or an interval that is less than zero, the corresponding "set" method must throw an Exception object having an appropriate error message. To enforce these edits during construction, the class constructor should call the "set" methods and re-throw any Exception object that may be caught.

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).

 

App class

This public class will define the processing of your applet. Its required features are as follows:

Input Components:

Output components:

Processing notes:

 

Grading criteria

Your program will be worth 30 points to be awarded as follows:

 

Submission

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:

D:\Test\src\App.java

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.