Question: public class Employee { / * * * * * * * * * * * * * * * * * * * *

public class Employee {
/*********************
Attributes
*********************/
String Fname;
String Lname;
float rate =30.0f;
float taxrate =0.2f;
int hours =45;
float gross =0.0f;
float tax =0.0f;
float net =0.0f;
float net_percent =0.0f;
public String getFname(){
return Fname;
}
public void setFname(String fname){
Fname = fname;
}
public String getLname(){
return Lname;
}
public void setLname(String lname){
Lname = lname;
}
public float getRate(){
return rate;
}
public void setRate(float rate){
this.rate = rate;
}
public float getTaxrate(){
return taxrate;
}
public void setTaxrate(float taxrate){
this.taxrate = taxrate;
}
public int getHours(){
return hours;
}
public void setHours(int hours){
this.hours = hours;
}
public float getGross(){
return gross;
}
public void setGross(float gross){
this.gross = gross;
}
public float getTax(){
return tax;
}
public void setTax(float tax){
this.tax = tax;
}
public float getNet(){
return net;
}
public void setNet(float net){
this.net = net;
}
public float getNet_percent(){
return net_percent;
}
public void setNet_percent(float net_percent){
this.net_percent = net_percent;
}
// End Attributes
/********************
Constructors
********************/
public Employee(String firstName, String lastName, int hoursWorked, float payRate){
Fname = firstName;
Lname = lastName;
hours = hoursWorked;
rate = payRate;
}
/********************
Methods
********************/
public void menu(){
computeGross();
computeTax();
computeNet();
computeNetperc();
displayEmployee();
}
public void computeGross(){
if (hours <=40)
gross = hours * rate;
else
gross =(40* rate)+((hours -40)* rate *1.5f);
}
protected void computeTax(){
tax = gross * taxrate;
}
protected void computeNet(){
net = gross - tax;
}
protected void computeNetperc(){
net_percent =(net / gross)*100;
}
protected void displayEmployee(){
System.out.println("Employee Name: "+ getFname()+""+ getLname());
System.out.println("Gross Pay: "+ getGross());
System.out.println("Tax: "+ getTax());
System.out.println("Net Pay: "+ getNet());
System.out.println("Net Percent: "+ getNet_percent()+"%");
}
}
Am I doing this right?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!