Have you ever caught yourself pondering over the following question: "Do I want to drink coffee or tea at the moment?"
If the answer is YES, fear no more! The following Java applet has the answer. Just click on the link below to get a 99.9% accurate recommendation on which beverage you secretly crave at the moment.
[Disclaimer: The authors of the applet can't be sued. Blame pseudo-random number generators.]
Whatever will it be? Whatever will it be? Will it be coffee? Will it be tea?
(The Java applet that lived here no longer runs: browsers dropped Java applet support years ago.)
The Java source code for the applet is as follows:
Beverage.java
import java.applet.Applet;
import java.awt.*;
/**
* An Applet that gives advice on which beverage to drink.
* @author Ando Roots & Carolys K.
*/
public class Beverage extends Applet {
/**
* The main method, sets the conditions for printing output.
*/
public void paint(Graphics g) {
// Get applet's dimensions
int w = getWidth();
int h = getHeight();
// Make the background black
g.setColor(Color.black);
g.fillRect(0, 0, w, h);
// Set font
g.setFont(new Font("Helvetica", Font.BOLD, 18));
// Whatever will it be? Whatever will it be? Will it be coffee? Will it be tea?
if (Math.random() < 0.5) {
g.setColor(Color.green);
g.drawString("Have a nice cup of coffee :).", 50,50);
} else {
g.setColor(Color.orange);
g.drawString("Drink tea, it's good for you :).", 50,50);
}
}
}
