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!

