Java Codes
--+o0O0o+--
Develop a program that will determine the gross pay for
each of several employees. The company pays “straight-time” for the first 40
hours worked by each employee and pays “time-and-a-half” for all hours worked
in excess of 40 hours. You are given a list of the employees of the company,
the number of hours each employee worked last week and the hourly rate of each
employee. Your program should input this information for each employee, and
should determine and display the employee’s gross pay.
Code:
import java.util.Scanner;
public class MachineProblem11 {
public static
void main(String[] args) {
Scanner
input_user = new Scanner(System.in);
float
hour_rate,salary;
int
hours_worked;
System.out.println("*****************************************");
for(int x =
0;x < 1000;x++)
{
System.out.print(" Enter #
of hours worked (-1 to end): ");
hours_worked = input_user.nextInt();
if(hours_worked != -1)
{
System.out.print(" Enter
hourly rate of the worker ($00.00): ");
hour_rate = input_user.nextFloat();
salary = hours_worked * hour_rate;
System.out.println("*****************************************");
System.out.println(" The interest charge is $" + salary);
System.out.println("*****************************************");
}
else
{
return;
}
}
}
}
Walang komento:
Mag-post ng isang Komento