Lab # 7

Part I should be written up and submitted to your instructor at the beginning of class on the due date. IT WILL NOT BE ACCEPTED LATE.

Part II is the programming component. It should be submitted  as a zip file  including all java files  ( as you did for Lab 6) and submit only the resulting Lab7.zip file with TURNIN. Of course, you should also ALWAYS verify that your lab can be executed correctly from the web as well.

Part I. Experiment. (20%).

Use the Java code provided in the "Lab7ExperimentCode" file to create a Lab7Experiment. (Follow the same procedure that you used to create your past labs). Modify the width and height parameters as required in order to see all components (I recommend width=500 height=200)

Experiment with this code to answer the questions in this section.

With the experiment you will get a better handle when working with arrays and collections.

REMEMBER - ALL EXPERIMENTS MUST BE TYPED - NOT HANDWRITTEN!!!!

For questions 1-5 perform each of the tasks described. (You should modify the Lab7Experiment code and run the program to verify your answers; after each question restore the code to its original form to continue)

1.  What is the function of method validate(JTextField datum) ? What does it return and how is that value used?

2.  In the  method procMax()  what would be the difference of changing numData for data.length  in the instruction    for(int i=0;  i < numData ; i++ )   ?

3.  In the method addPanel() why do you need   to include the statement:

     disFields = new JTextField[numData];

To determine the answer,  try running your program without this line. What do you get?

4.  In the same method addPanel() why do you need  to include within the for block the statement:

     disFields[i] = new JTextField(5);

To determine the answer,  try running your program without this line. What do you get?

5. What is the difference between a Integer.parseInt() and and Double.parseDouble() when validating data?

Part II. Programming. (80%)

In this next assignment The Phone Company has asked you to modify your Lab6 applet to maintain a history of their customers (minimally their names, service plan types, and monthly plan cost). Feel free to keep and display other facts about customers as you see fit!

 

Your applet should illustrate the use JFrames as discussed in class as well as your skills on the use of one dimensional collections. You will be graded on its appearance, the appropriate use of widgets and its correct functionality. Please feel free to be creative, here I provide my applet demo. Note You may safely program for a maximum of 100 customers for testing purposes.