====================================================================== CPS 1: Computer Science Fundamentals SAMPLE Lab Final ====================================================================== Be sure to read the WHOLE handout before starting and follow all of the directions. You should do this program in steps The goal of this lab is to make an applet that will list and lookup the names of the Head Lab TAs. ---------------------------------------------------------------------- 1. Building the applet (8 points) ---------------------------------------------------------------------- Make a HTML file named Lookup.html and a Java file named Lookup.java. The HTML file should have your name, login, lab section, and the title of the applet on it. You will need the following elements in your applet. You should probably make sure that you successfully created the buttons and fields before you head to the next step. You will need the following input fields: 1. an IntField to input the number of the lab to search for. You will need the following output fields: 1. a TextField to output the instructions 2. a TextArea to output the names of all the TAs 3. a TextField to output the name of the matching record found You will need the following buttons: 1. a button labeled "List" which when pressed will list all names up to and including that lab # 2. a button labeled "Specific TA" which when pressed will output the TA for that particular lan A finished example applet can be found at: http://www.cs.duke.edu/courses/spring01/cps001/labs/labfinal/Lookup.html ---------------------------------------------------------------------- 2. Storing & Calculating the data (4 points) ---------------------------------------------------------------------- You need to create an array to hold the names of the Head Lab Tas The names are (in order): Xue, McBride, Wolkstein, Khouri, Desantis, Seide, Nehme, Su, Stahl You need to declare and store these values in an array. ---------------------------------------------------------------------- 3. Display output (6 points) ---------------------------------------------------------------------- At the beginning, the instructions TextField should give some message which tells the user something like "Enter a lab# and press either the List or Specific TA button." If the user hits the ListAll button, you should loop through the stored names and print the names as follows up to the section number. For example if the user were to put 3 in the IntField, the output TextArea would read: ------------------------------ | TA1: Xue | | TA2: McBride | | TA3: Wolkstein | | | ------------------------------ If the user enters a number that is not in the range 1-9, then you should print all TAs If the user hits the Specific TA button, your program should output the name of the TA for the section indicated in the IntField. For example, if the user were to put 3 in the IntField, the output TextField would read: Wolkstein If the user enters a number below 1 or above 9, you should not print anything and the program should not crash. ---------------------------------------------------------------------- 4. Submitting your applet (2 points) ---------------------------------------------------------------------- Just as with all of the previous labs, you should submit You must submit the java code and your webpage with the following command. /afs/acpub/project/cps/bin/submit_cps001 labfinal/secA Lookup.java Lookup.html The submission must be received before the end of your scheduled lab time. You may submit as many times as you like until the end of the lab period, but only the last one will count. ====================================================================== End of lab final