Java Coockies!!


Jump to Page:
< Previous  [ 1 ]    Next >




ramesh chawda   
Member since: Apr 03
Posts: 3
Location:

Post ID: #PID Posted on: 15-04-03 10:48:31

First Run this program

Quote:

SuperMarket sm = new SuperMarket("Sainsburys";);
ArrayList basket = new ArrayList();

basket.add(sm.buy("250g all-purpose flour";));
basket.add(sm.buy("1 tsp baking soda";));
basket.add(sm.buy("1/4 tsp salt";));
basket.add(sm.buy("200g butter";));
basket.add(sm.buy("165g brown sugar";));
basket.add(sm.buy("100g white sugar";));
basket.add(sm.buy("1 tsp vanilla extract";));
basket.add(sm.buy("1 egg";));
basket.add(sm.buy("100g chocolate chips";));




Then do this:


Quote:

// Preheat oven for ten minutes.
Oven oven = Oven.getInstance();
oven.setTemperature(175);

try {
Thread.sleep(600000); // 10 minutes.
}
catch (InterruptedException e) {
System.out.println("No cookies today :(";);
}




Then do This:


Quote:

Cupboard cupboard = Cupboard.getInstance();

cupboard.open();
Collection bowl = cupboard.get("bowl";);
cupboard.close();

Iterator it = basket.iterator();
while (it.hasNext()) {
Ingredient ingredient = (Ingredient) it.next();

if (ingredient == null) {
throw new RuntimeException("Duh, you forgot an ingredient!";);
}

bowl.add(ingredient);
Collections.shuffle(bowl);
}




Again do this:


Quote:

cupboard.open();
Collection tinFoil = cupboard.get("greased tin foil";);
Collection tray = cupboard.get("baking tray";);
cupboard.close();

tray.add(tinFoil);

for (int i = 0; i < 9; i++) {
tinFoil.add(new Cookie(bowl));
}



Do this:


Quote:

// Stick the tray in the oven for at least 10 minutes.
oven.open();
oven.add(tray);
oven.close();

try{
Thread.sleep(600000); // 10 minutes.
}
catch (InterruptedException e) {
System.out.println("Schtop! These cookies are not ready yet!";);
}




Do this:


Quote:

// Check on the progress of the cookies every minute.
boolean stillWaiting = true;
while (stillWaiting) {
try {
Thread.sleep(60000); // One minute.
}
catch (InterruptedException e) {
System.out.println("Stop interrupting me!";);
}

// Check that all the cookies are cooked!
stillWaiting = false;
for (int i = 0; i < tinFoil.size(); i++) {
Cookie cookie = (Cookie) tinFoil.get(i);
if (!cookie.isCooked()) {
stillWaiting = true;
break;
}
}
}

// Take the tray out.
oven.open();
tray = (Collection) oven.remove(oven.indexOf(tray));
oven.close();

// Bug fix suggested by Tim Bishop.
// (We forgot to turn off the oven!)
oven.turnOff();

// Wait for things to cool down.
try {
tray.wait(300000); // 5 minutes.
}
catch (InterruptedException e) {
System.out.println("Ouch! Burnt fingers!";);
}




Finally:

Quote:

it = tray.iterator();
while (it.hasNext()) {
Cookie cookie = (Cookie) it.next();
cookie.eat();
}





Jump to Page: < Previous  [ 1 ]    Next >

Discussions similar to: Java Coockies!!

Topic Forum Views Replies
How make soft cake without egg?
Rasoi & Restaurants 4650 1
Java Coockies!!
Have Fun! 1773 0
ALOO KA BHARTA ( 1 2 )
Rasoi & Restaurants 3113 8
DRIVER’S HANDBOOK NOTES
Just Landed 5525 2
DAY OF SHAME! ( 1 2 3 ... Last )
Our Native Country! 22884 112
Jobs Offered -Dubai/London
Available 2419 0
this was a real problem----never give up!!!!
Have Fun! 1555 1
Take ur time and be a computer man
Science & Technology 1553 1
Toronto will have to upgrade ALL signs to French!!
Life 2943 2
Looking for JAVA developers (Toronto)
Jobs 3421 4
KHANA KHAZAANA
Rasoi & Restaurants 2694 4
Top Eight Reasons NOT to immigrate to Canada ** ( 1 2 3 ... Last )
Jobs 65203 324
Java hands-on training ( 1 2 )
Study 4295 12
The first ever East Indians to set foot in Canada
Life 5388 1
Sticky: Recipes ( 1 2 3 ... Last )
CD Recipes 22489 46
Never under estimate customer complaints!!!
Have Fun! 1523 0
Brown-nosers
Arts and Culture 1336 2
Need help in filling out application - Your advice ( 1 2 )
Ask Immigration Expert 5635 11
BEWARE OF MOVERS ( 1 2 )
General 4368 8
What a white man thinks?
Life 2176 1
Reduction in parent immigration quota ( 1 2 3 ... Last )
Family Class 15060 69
Online "Web Application Java EE" & "Enterprise Java EE" Course
General 1994 0
Magic mushrooms
Have Fun! 1000 1
Aloo Gobhi
General 1142 0
Chilli Pickle
Rasoi & Restaurants 1598 0
 


Share:
















Advertise Contact Us Privacy Policy and Terms of Usage FAQ
Canadian Desi
© 2001 Marg eSolutions


Site designed, developed and maintained by Marg eSolutions Inc.