Java Reference
In-Depth Information
1.
In the ReviewEx/src, create a new Java package called c2.
2.
Copy ShipmentApp from c1 to c2 by performing the following:
A.
Click on ShipmentApp.java in the Navigation tree to select it
Click Edit then Copy
B.
C.
Click on c2 to select it
Click Edit then Paste
D.
3.
In c2, create a public class called Shipment without any method stubs.
Define five class String variables called shipmentNum, supplierName, rcvDate, rcvTime,
employeeNum.
4.
5.
Create a constructor that:
A.
Accepts 5 strings and stores them in 5 method variables (parameters) called
sNum, sName, rDate, rTime, eNum
(Hint: When specifying multiple parameters they must be separated by commas.)
B.
Moves the method parameter's values to the class variables
6.
Save the Shipment source code and verify that there are no errors.
7.
Change ShipmentApp's main method to:
A.
Create a Shipment object and assign it to a variable called shipObj
B.
Pass the following five pieces of information to the Shipment object:
99, Costco, 12/15/2011, 10:25 AM, 33
(Hint: When specifying multiple parameters they must be separated by commas.)
8.
In Shipment, create a public method called display that accepts nothing, returns nothing
and uses System.out.println to display the five values as below:
99
Costco
12/15/2011
10:25 AM
33
9.
Change ShipmentApp to invoke the Shipment objects display method.
Check that the Exercise Was Done Correctly
Finally, let's check everything ran as expected:
1.
Verify that within c2 there are two tree items called Shipment.java and ShipmentApp.java.
2.
Run ShipmentApp and verify that the data is displayed in the console as specified earlier.
 
Search WWH ::




Custom Search