//Payroll Program Part 2
package payrollprogrampart2;
/**
*
* @author Zach
*/
import java.util.Scanner;
public class PayrollProgramPart2 {
public static void main(String args [])
{ System.out.println("Welcome to Zach's Payroll Program");
Scanner input = new Scanner( System.in );
String employeeName;
System.out.print("What is the employee's name?");
boolean stop = false;
while (!stop)
System.out.print("Enter Employee's name or stop to exit program:");
String empName = input.nextLine();
if ( empName.equals ("stop"))
{
System.out.println("Program Exited");
stop = true;
int number1;// hourly rate
int number2;// total hours
int sum;// total weekly pay
System.out.print("Enter hourly rate:");
number1 = input.nextInt();
while (number1 <= 0)
System.out.print( "Hourly rate must be a positive number." );
number1 = input.nextInt ();
System.out.print( "Enter total hours: " );
number2 = input.nextInt();
while (number2 <= 0)
System.out.print("Hours worked must be a postive number.");
number2 = input.nextInt();
sum = number1 * number2;
System.out.printf("Sum is %d\n",sum);
}
zach1280 0 Newbie Poster
zach1280 0 Newbie Poster
AurosGamma 0 Newbie Poster
zach1280 0 Newbie Poster
pro_learner 0 Junior Poster
.:n'tQ-boy:. 0 Light Poster
.:n'tQ-boy:. 0 Light Poster
pro_learner 0 Junior Poster
pro_learner 0 Junior Poster
zach1280 0 Newbie Poster
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.