I was wondering if someone could check this for me. Ive to write a loop in words, this is what ive came up with.

while (there are days left in holiday)
if (sunny)
go to beach
else
go to swimming pool
go home

Basically its a program that tells you to go home if your holiday is finished, or if there is holidays left over and its sunny, go to beach else go to the swimming pool.
Thanks for your help, Paul

The days left can be a static variable. The rest of the code can be put in a method. Every time you call that method reduce that variable by 1. Assuming that each call represents each day that passes. when the days becomes zero, with the help of the if statements , print that "go home" and then exit the program.
If you want to put everything in a while loop you can do this:

int daysLeft = 30;
while (daysLeft>0) {
  ....
  ....

  daysLeft--;
}
System.out.println("Go Home");

The isSunny or not can be obtained by generating a random number (Math.random). It returns a number between 0 and 1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.