public class iComputer { public static void main(String[] args) { // Create all the parts. iPowerSupply PowerSupply = new iPowerSupply(120); // 120 Volts A/C iCase Case = new iCase(iCase.MiniTower); // minitower case iVideoCard VideoCard1 = new iVideoCard(4, "4 MB XVGA"); // video card w/ 4 MB of memory System.out.println("Computer: VideoCard1 occupies slot " + VideoCard1.getSlot()); iVideoCard VideoCard2 = new iVideoCard(2, "2 MB Card"); // video card w/ 2 MB of memory System.out.println("Computer: VideoCard2 occupies slot " + VideoCard2.getSlot()); iDiskController Controller1 = new iDiskController(3, "SCSI"); // up to 3 drives possible System.out.println("Computer: Controller1 occupies slot " + Controller1.getSlot()); iDiskDrive Disk1 = new iDiskDrive(); // 1GB disk drive iDiskDrive Disk2 = new iDiskDrive(8192, "8 GB Big Disk"); // 8 GB disk drive iCDROM Disk3 = new iCDROM(650, "CD-ROM Drive"); iCDROM Disk4 = new iCDROM(17000, "DVD Drive"); // Perform some sanity checks. if (VideoCard1.getSlot() == VideoCard2.getSlot()) { System.out.println("Computer: Assertion # 1 fails!"); } if (VideoCard1.slotNumber == VideoCard2.slotNumber) { System.out.println("Computer: Assertion # 2 fails!"); } if (VideoCard1.nextSlot != VideoCard2.nextSlot) { System.out.println("Computer: Assertion # 3 fails!"); } iCPU CPU = new iCPU(400); // 400 MHz CPU System.out.println("Computer: CPU speed = " + CPU.clockSpeed); // Power it all up & initialize appropriately. PowerSupply.PowerUp(); VideoCard1.PowerUp(); VideoCard2.PowerUp(); Controller1.PowerUp(); Disk1.PowerUp(); Disk1.formatDevice(); System.out.println("Computer: Disk 1 capacity = " + Disk1.getCapacity() + "MB"); System.out.println("Computer: Disk 1 type = " + Disk1.diskType); Disk2.PowerUp(); Disk2.formatDevice(); System.out.println("Computer: Disk 2 capacity = " + Disk2.getCapacity() + "MB"); System.out.println("Computer: Disk 2 type = " + Disk2.diskType); Disk3.PowerUp(); Disk3.formatDevice(); System.out.println("Computer: Disk 3 capacity = " + Disk3.getCapacity() + "MB"); System.out.println("Computer: Disk 3 type = " + Disk3.diskType); Disk4.PowerUp(); Disk4.formatDevice(); System.out.println("Computer: Disk 4 capacity = " + Disk4.getCapacity() + "MB"); System.out.println("Computer: Disk 4 type = " + Disk4.diskType); if (!Controller1.connectDrive(Disk1)) { System.out.println("Computer: Assertion # 4 failed!"); } if (!Controller1.connectDrive(Disk2)) { System.out.println("Computer: Assertion # 5 failed!"); } if (!Controller1.connectDrive(Disk3)) { System.out.println("Computer: Assertion # 6 failed!"); } if (Controller1.connectDrive(Disk4)) { System.out.println("Computer: Assertion # 7 failed!"); } } }