lab 1 8 4 2

background image

1 - 1

Fundamentals of Java Programming Lab 1.8.4.2

Copyright

 2003, Cisco Systems, Inc.

Lab 1.8.4.2 Case Study: Modify the Teller Class to Accept Runtime Data


Estimated Time: 20 minutes

Learning Objective:

• In this lab activity, the student will modify the Teller program to accept runtime input in

order to set the custName and tellerName


Description/Scenario:

Accepting input data for Teller class at runtime.

File management:

Using BlueJ, create a Teller class in the folder c:\javacourse\chap1\lab1.8.4.2 using the
following instructions:

Open BlueJ. Click on Project from the BlueJ main menu and select New. Select c:\ In the
New Project window and in the Look in: list box. Double click the javacourse folder listed
in the text window. A different New Project window opens with javacourse in the Look in:
list box. Double click the chap1 folder listed in the text window and a different New
Project window opens with chap1 in the Look in: list box. Type lab1.8.4.2 in the File
name text box and click on Create to create a lab1.8.4.2 subfolder in the chap1 folder.


Tasks:

Step 1 Modifying Teller class using BlueJ

a. Click on Project from the BlueJ main menu and select Import. In the Select Directory to

Import window, select lab1.8.4.1 and click on the Import button. In the Import Status
window, click the Continue button. Right click on the Teller class (the yellow box) and
select Open Editor.

b. Modify the Teller class main method to accept data at runtime by using this code:

String custName = args[0];

String tellerName = args[1];

c. Display the fields as in the previous Teller lab.
d. Compile and run the program.
e. To run the program with runtime input data, right click on the class and select the main

method as usual. This time, in the method call dialog window, place the input data
between the braces as Strings {“John Doe”, “Betty Smith”}. Click OK.

Step 2 Review Questions

a. Into which variables are the runtime data John Doe and Betty Smith placed?



Document Outline


Wyszukiwarka

Podobne podstrony:
spis lab I sem 2010
III WWL DIAGN LAB CHORÓB NEREK i DRÓG MOCZ
Diagnostyka lab wod elektrolit
ZW LAB USTAWY, OCHRONA
LAB PROCEDURY I FUNKCJE
sprzet lab profilografy
sprzet lab mikromanometry
Mechanika Plynow Lab, Sitka Pro Nieznany
Lab 02 2011 2012
PO lab 5 id 364195 Nieznany
lab pkm 4
MSIB Instrukcja do Cw Lab krystalizacja
lab [5] id 258102 Nieznany
lab 8 9 1
lab 3 2 9
IE RS lab 11 solutions
5 MDE lab nr 5 ogniwa fotogalwaniczne
lab pkm 5

więcej podobnych podstron