Application - System.out.println"Assigning ComboLock =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
package lab7; p public class Application { p public static void main(String[] args) { p //Instantiation of three objects 1superclass 2subclasses ComboLock aComboLock = new ComboLock(001122, "00-11-22"); NameId aNameId = new NameId("George Bush"); aNameId.setId(334455); aNameId.setCombination("33-44-55"); aNameId.setNameId("Arnold Swartzeneger"); DeleteDateId aDeleteDateId = new DeleteDateId(20070310); aDeleteDateId.setId(667788); aDeleteDateId.setCombination("66-77-88"); System.out.println("Initial Objects:"); System.out.println("Parent.ComboLockObject: "+aComboLock.toString()); System.out.println("Child.NameIdObject: "+aNameId.toString()); System.out.println("Child.DeleteDateIdObject: "+aDeleteDateId.toString()); System.out.println("Assigning ComboLock = NameId"); aComboLock = aNameId; System.out.println("ComboLockObject: "+aComboLock.toString()); S System.out.println("NameIdObject: "+aNameId.toString());
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println("Assigning ComboLock = DeleteDateId"); aComboLock = aDeleteDateId; System.out.println("ComboLockObject: "+aComboLock); System.out.println("DeleteDateIdObject: "+aDeleteDateId); S FileRead fr = new FileRead("polyComboLockData.txt"); String line = fr.readLine(); int LENGTH = 20; ComboLock comboLockArr = new ComboLock[LENGTH]; ComboLock bComboLock = new ComboLock(); String tempArr = new String[20]; int iteration = 0; while(line!=null) { tempArr = line.split(","); if(tempArr[4]!=null) { bComboLock.setId(Integer.parseInt(tempArr[3])); bComboLock.setCombination(tempArr[4]); comboLockArr[iteration]=bComboLock; iteration++; line = fr.readLine(); } else { line = fr.readLine(); } } for(int i=0; comboLockArr!=null; i++) { System.out.println(comboLockArr[i].toString()); } } }...
View Full Document

Page1 / 2

Application - System.out.println"Assigning ComboLock =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online