Need some help with loops :)

Hey guys i wrote some code which determines a persons gross Pay, simple code for most of you, and i am trying to keep looping that code until the person answers no. Heres the code.

import java.util.*;

import java.text.*;

publicclass Work

{

publicstaticvoid main(String[]args)

{

int hours;

double overTime, grossPay, payRate;

String ye, no, wrkPlace, name;

Scanner scan=new Scanner(System.in);

System.out.println("Would you like to calculate your Gross Pay:");

ye=scan.nextLine();

if (ye.equals("yes"))

{

System.out.println("What is your name?");

name=scan.nextLine();

System.out.println("What is the name of your workplace?");

wrkPlace=scan.nextLine();

System.out.println("Please input the number of hours every week :");

hours=scan.nextInt();

System.out.println("Enter your pay rate :");

payRate=scan.nextDouble();

if(hours>40)

{

overTime=(hours-40)*((.5*payRate)+payRate);

grossPay=overTime+(40*payRate);

}

else

grossPay=hours*payRate;

System.out.println("Your gross pay is $"+grossPay);

}

else

System.out.println("Thats beacause you don't know how to spell yes you Idiot!");

}

}

I know that we have to do a do while loop but i dont get how to write it in. Any ideas will help. And if you were wondering this is not for homework, im just trying it for fun!

[2358 byte] By [Progr@mera] at [2007-10-3 9:45:33]
# 1
[url] http://java.sun.com/docs/books/tutorial/java/nutsandbolts/while.html[/url]
bckrispia at 2007-7-15 5:02:14 > top of Java-index,Java Essentials,New To Java...
# 2
while(ye.equalsIgnoreCase("yes")) {// your code}
floundera at 2007-7-15 5:02:14 > top of Java-index,Java Essentials,New To Java...
# 3

well, having a loop might help.

here is the sytax for a while loop:

boolean condition = true;

int count = 0;

while(condition){

//do something and set condition to false

if(count == 10) condition = false;

count++;

}

mkoryaka at 2007-7-15 5:02:14 > top of Java-index,Java Essentials,New To Java...
# 4
Thanks, I'll give it a shot guys!
Progr@mera at 2007-7-15 5:02:14 > top of Java-index,Java Essentials,New To Java...