import java.util.Scanner; public class Quiz9 { public static void main(String[] args) { Scanner kb = new Scanner(System.in); Utility util1 = new Utility(); Payroll emp1 = new Payroll(); String strFirstName; String strLastName; String strSocialSecurityNumber; String strInfo; double dTotalPay; double dTotalAverage; double dRateOfPay; double dHoursWorked; int iNumberOfDependents; while(true) { util1.clearScreen(); System.out.print("What is the users first name?"); strFirstName = kb.nextLine(); emp1.setFirst(strFirstName); System.out.print("What is the user's last name?"); strLastName = kb.nextLine(); emp1.setLast(strLastName); System.out.print("What is the user's Social Security Number?"); strSocialSecurityNumber = kb.nextLine(); emp1.setSSN(strSocialSecurityNumber); System.out.print("What is the user's rate of pay?"); dRateOfPay = kb.nextDouble(); emp1.setRate(dRateOfPay); System.out.print("How many hours did the user work?"); dHoursWorked = kb.nextDouble(); emp1.setHours(dHoursWorked); System.out.print("How many dependants does the user have?"); iNumberOfDependents = kb.nextInt(); emp1.setDependents(iNumberOfDependents); strInfo = emp1.toString(); System.out.print(strInfo); util1.pressEnterToContinue(); util1.clearScreen(); }//end of while true if(dHoursWorked == 0) { System.exit(0); } } }
Why is my if statement unreachable?
Also, how would I take the total of all the wages entered and output them at the end of the program?
Also, why can I not input a first name for an employee after the first run?
Thanks for the help!