Reference no: EM13892638
Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate. Make sure the program maintains all the functionality required in previous assignments and your source code is readable and well documented. Use feedback you have received from the instructor to make any needed modifications.
The application compiles and runs.
The application properly uses a class for employee information.
The application uses a constructor to initialize the employee information and a method within the class to calculate the weekly pay.
The source code is readable and well documented.
The application performs all the required functionality from previous weeks.
This is what I already have:
package It215week2;
import java.util.*;
/**
* Monitors employees weekly salary when enter and bonus amount
* Loop feature add
* Program will continue to until user enter "stop" then program will terminate
*
* @author John Doe
*/
public class PayrollSystemProgram {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
try {
// requests the user input the name of the employee, the hourly
// rate, and the number of hours worked.
System.out.print("Enter the name of Employee:");
String employeeName = scanner.nextLine();
while(!employeeName .equals("stop"))
{
System.out.print("Hourly Rate : $");
double hourRate = scanner.nextDouble();
while(hourRate {
System.out.println("Hourly Rate should be a positive value.");
System.out.print("Hourly Rate : $");
hourRate = scanner.nextDouble();
}
System.out.println("Number of hours worked :");
int hoursWorked = scanner.nextInt();
while(hoursWorked {
System.out.println("Hourly Rate should be a positive value.");
System.out.println("Number of hours worked :");
hoursWorked = scanner.nextInt();
}
double weeklyPay = 0, bonusPay = 0;
// calculating weekly pay and bonus pay
if (hoursWorked > 40) {
// if hourly worked is more than 40
// then The bonus amount is the number of hours more than 40
// times the hourly rate
weeklyPay = (double) hourRate * hoursWorked;
bonusPay = (double) (hoursWorked - 40) * hourRate * 0.5;
} else {
weeklyPay = (double) hourRate * hoursWorked;
}
// name of the employee and the correct weekly pay amount in dollar
// format and bonus amount in dollar format
System.out.println("***WEEKLY PAY***");
System.out.println("-----------------");
System.out.println("Employee Name:" + employeeName);
System.out.println("Weekly pay amount :$" + weeklyPay);
if (bonusPay != 0) {
System.out.println("Bonus amount :$" + bonusPay);
}
System.out.print("Enter the name of Employee:");
scanner.nextLine();
employeeName = scanner.nextLine();
}
} catch (Exception e) {
// TODO: handle exception
} finally {
scanner.close();
}
}
}
Compare characters of troy and rose in august wilsons fences
: Compare and contrast the characters of Troy and Rose in August Wilson's Fences. To what extent are each of these characters responsible for their tragedy?
|
How would such a condition affect your work life
: Finally, describe what it might be like to have presbycusis. Include the following points: If you have normal hearing now, how would your ability to converse with others be affected? What activities that you now enjoy would be limited by this conditi..
|
Describe a specific issue related to health care access
: Describe a specific issue related to health care access or policy with respect to a particular ethnic or socioeconomic group.
|
What does it mean to consecrate a place?
: What does it mean to consecrate a place?
|
Modify the payroll program so that it uses a class to store
: Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the w..
|
How did you frame the decisions you had to make
: What biases and past experiences influenced your impressions and decision making? Do you think aspects of your culture or views of a different culture impacted your impressions? How did you frame the decisions you had to make? How did your emotions..
|
Use the 2s complement
: Problem 1 Convert the following decimal numbers into (a) 8-bit, (b) 16-bit, and (c) 32-bit binary numbers. For negative numbers, use the 2's complement. State "overflow" if a number cannot be represented correctly. 1) 45 ten. 2) -81 ten. 3)-3,0..
|
What legal implication of these challenges for administraton
: Summarize significant findings about this group that inform attitudes and preferences around end-of-life care (e,g., inform consent, life support, advance directives, communication styles, and/or decision making, etc.), and cite your sources of info..
|
Unadjusted trial balance and information for the accounting
: 1.The unadjusted trial balance and information for the accounting adjustments of Noseworthy Investigators follow.
|