Kurt Shaped Box (talk | contribs) |
204.102.108.32 (talk) No edit summary |
||
Line 1: | Line 1: | ||
//Michael Johnson |
|||
public class Joh_Ex2_19 |
|||
{ |
|||
public static void main (String[ ] args) |
|||
{ Vic.say ("This program fills the third and fourth slots in the second sequence."); |
|||
Vic.reset (args); |
|||
if (Vic.stackHasCD()) |
|||
{ SmartVic bob1; |
|||
bob1 = new SmartVic(); |
|||
SmartVic bob2; |
|||
bob2 = new SmartVic(); |
|||
if (bob2.seesSlot()) |
|||
{ bob2.moveOn(); |
|||
bob2.moveOn(); |
|||
if (bob2.seesSlot()) |
|||
{ bob2.moveOn(); |
|||
if (bob2.seesSlot()) |
|||
{ bob2.putCD(); |
|||
if (Vic.stackHasCD()) |
|||
{ bob2.moveOn(); |
|||
bob2.putCD(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
public void fillThree() |
|||
{ if (Vic.stackHasCD()) |
|||
{ putCD(); |
|||
if (Vic.stackHasCD()) |
|||
{ moveOn(); |
|||
putCD(); |
|||
if (Vic.stackHasCD()) |
|||
{ moveOn(); |
|||
putCD(); |
|||
} |
|||
} |
|||
} |
|||
} //====================== |
|||
} |
|||
//Michael Johnson |
|||
public class Joh_Ex2_20 |
|||
{ |
|||
public static void main (String[ ] args) |
|||
{ Vic.say ("This program fills the first three slots."); |
|||
Vic.reset (args); |
|||
if (Vic.stackHasCD()) |
|||
{ SmartVic sue; |
|||
sue = new SmartVic(); |
|||
sue.fillThree(); |
|||
if (Vic.stackHasCD()) |
|||
{ SmartVic sam; |
|||
sam = new SmartVic(); |
|||
sam.fillThree(); |
|||
} |
|||
} |
|||
} //====================== |
|||
} |
Revision as of 21:37, 23 April 2007
//Michael Johnson public class Joh_Ex2_19 { public static void main (String[ ] args) { Vic.say ("This program fills the third and fourth slots in the second sequence.");
Vic.reset (args); if (Vic.stackHasCD()) { SmartVic bob1; bob1 = new SmartVic();
SmartVic bob2; bob2 = new SmartVic(); if (bob2.seesSlot()) { bob2.moveOn(); bob2.moveOn(); if (bob2.seesSlot()) { bob2.moveOn(); if (bob2.seesSlot()) { bob2.putCD(); if (Vic.stackHasCD()) { bob2.moveOn(); bob2.putCD(); } } } } } } }
public void fillThree()
{ if (Vic.stackHasCD())
{ putCD();
if (Vic.stackHasCD())
{ moveOn();
putCD();
if (Vic.stackHasCD())
{ moveOn();
putCD();
}
}
}
} //======================
}
//Michael Johnson public class Joh_Ex2_20 {
public static void main (String[ ] args) { Vic.say ("This program fills the first three slots."); Vic.reset (args); if (Vic.stackHasCD()) { SmartVic sue; sue = new SmartVic(); sue.fillThree(); if (Vic.stackHasCD()) { SmartVic sam; sam = new SmartVic(); sam.fillThree(); } } } //====================== }