PAYROLL . JAVA
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
// @author Luther Mann
// IT 215
// 12-13=10
// Payroll 1
package payroll;
/**
*
*
*/
import java.util.Scanner;
public class Payroll {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in); //accepts keyboard input
Employees sa; //storage object
String FirstName; // Decalre First Name as String
String LastName; // Declare Last Name as String
double PayRate; //Declare ParRate as double
double Hours; // Declare Hours as String
double Pay; //Declares Pay as Double
Boolean Continue = true; // Does FirstName = Stop
while(Continue=true)
{
Hours = 0;
PayRate = 0;
System.out.println("Employees First Name: ");
System.out.println("Type Stop to end program");
FirstName= input.next(); // Input Empoyee's First Name
if(!FirstName.equalsIgnoreCase("stop")){
System.out.println("Employees Last Name: ");
LastName = input.next(); // Input Employee's Last Name
while(PayRate<=0)
{
System.out.println("Employees Hourly Rate: ");
PayRate = input.nextDouble(); // Input Employee's Hourly Rate
}
while(Hours<=0)
{
System.out.println("Employees Total Work Hours: ");
Hours = input.nextDouble(); // Input Employee's Total Hours Worked
}
//Create a new class and pass the values of the variables
sa = new Employees(FirstName, LastName, PayRate, Hours);
// Display Employee's First and Last name and Current Pay
System.out.printf("%s %s's Current Pay: $%.2f\n", sa.getFrstName(), sa.getLstName(), sa.EmployeePay());
System.out.println(" ");
}
else
break;
}
}
}
EMPLOYEES . JAVA
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package payroll;
/**
*
* @author Luther Mann
*/
public class Employees {
//Define class Variables
String FrstName; // Decalre First Name as String
String LstName; // Declare Last Name as String
double GrossPay; // Declare GrossPay as Double
double PyRate; // Declare PayRate as Double
double Hors; // Declare Hours as Double
double Overtime; // Declare Overtime as Double
double OTPay; // Declare OTPay as Double
double EmpPay; //Declare Pay as Double
Employees(String FirstName, String LastName, double PayRate, double Hours)
{
this.FrstName = FirstName;
this.LstName = LastName;
this.Hors = Hours;
this.PyRate = PayRate;
}
/**
*
* @return the FrstNAme
*/
public String getFrstName(){
return FrstName;
}
/**
*
* @param FrstName the FrstName to set
*/
public void setFrstName(String FrstName){
this.FrstName = FrstName;
}
/**
*
* @return the LstNAme
*/
public String getLstName() {
return LstName;
}
/**
*
* @param LstName the LstName to set
*/
public void setLstName(String LstName) {
this.LstName = LstName;
}
/**
*
* @return the Hors
*/
public Double getHors () {
return Hors;
}
/**
*
* @param Hors the Hors to set
*/
public void setHors (Double Hors) {
this.Hors = Hors;
}
/**
*
* @return the PyRate
*/
public Double getPyRate () {
return PyRate;
}
/**
* @param PyRate the PyRate to set
*/
public void setPyRate (double PyRate) {
this.PyRate = PyRate;
}
public double EmployeePay() //Compute employee Pay and return it
{
if (Hors > 40) {
Overtime = (Hors - 40);
GrossPay = (PyRate * 40);
OTPay = (Overtime*(PyRate*1.5));
EmpPay = (OTPay + GrossPay);
}
else {
EmpPay=(PyRate*40);
}
return EmpPay;
}
}
Published by David Crass
I am a long time video gamer, computer geek, and network administrator. I have training in A+, Network+, Server+, and inet+. i have multiple courses in Microsoft products, and i am attending the University o... View profile
- Ge Profile 24.9 Cu. Ft. Side-by-Side Refrigerator with Double Bottom-Mount Freezer...If you are looking for a refrigerator that will give your kitchen a unique look and ample freezer storage space, than you will love this double bottom-mount refrigerator.
Why Aren't There More Double Weddings?I recently wrote an article that was inspired by a family of girls having three consecutive weddings at the father's expense. I couldn't stop wondering however, why two or three...- GE Profile Double Microwave Convection Wall Oven ReviewThe GE Profile Double Microwave/Convection Wall Oven, Model: PT970WM has been designed to not only provide you with the best possible cooking power, but also, allow you to spend less time in the kitchen, and more time...
- Invoke Method Using Method Name as String in Java
- Beer Tasting Review of Double Hopped Venom by Duclaw
- Best Double Stroller: Side-By-Side vs. Tandem
- Double Diabetes:The New Health Risk
- Splinter Cell: Double Agent
- Entertainment Room Refrigerator - KitchenAid Built-In Double Drawer Refrigerator
- Burger King's New Double Cheeseburger: How Does it Really Compare to McDonald's?



