I have a 2 class code and it works everything is fine and runs as it supposed too. What will the UML be for both classes. Here's the code, any help will be awsome, Thanks.
import java.util.Scanner;
public class PayRollDemo
{
public static void main(String[] args)
{
double payRate;
int hours;
PayRoll pr = new PayRoll();
Scanner keyboard = new Scanner(System.in);
for (int index = 0; index < 7 ; index++ )
{
System.out.println();
System.out.println("EmployeeID:" + pr.getEmployeeID(index));
System.out.println();
System.out.println("Enter the hours worked:");
hours = keyboard.nextInt();
pr.setHours(index, hours);
while (hours < 0)
{
System.out.println("Invalid number, please enter a " +
" positive number.");
System.out.println("Enter the hours worked:");
hours = keyboard.nextInt();
pr.setHours(index, hours);
}
System.out.println("\n \n");
System.out.println("Enter the pay rate per hour:");
payRate = keyboard.nextDouble();
pr.setpayRate(index, payRate);
while (payRate < 6.00)
{
System.out.println("Invalid number, please enter a " +
"number that's not less then 6.00 for the pay rate.");
System.out.println("Enter the hours that the employee has
worked:");
payRate = keyboard.nextDouble();
}
System.out.println();
}
pr.TotalGrossPay();
for (int index = 0; index < 7 ; index++ )
{
System.out.println("EmployeeID: " + pr.getEmployeeID(index) +
"\n"
+ pr.getWages(index));
}
}
}
public class PayRoll
{
private int[] employeeID = {5658845, 4520125, 7895122,
8777541, 8451277, 1302850,
7580489};
private int[] hours = new int[7];
private double[] payRate = new double[7];
private double[] wages = new double[7];
/**
* The
*/
public void setHours(int index, int hours)
{
this.hours[index] = hours;
}
public void setpayRate(int index, double payRate)
{
this.payRate[index] = payRate;
}
public void setEmployeeID(int index, int employeeID )
{
this.employeeID[index] = employeeID;
}
public void setWages(int index, double wages)
{
this.wages[index] = wages;
}
public double getHours(int index)
{
return hours[index];
}
public double getpayRate(int index)
{
return payRate[index];
}
public int getEmployeeID(int index)
{
return employeeID[index];
}
public double getWages(int index)
{
return wages[index];
}
public void TotalGrossPay ()
{
for (int index = 0; index < employeeID.length; index++
)
{
wages[index] = hours[index] * payRate[index];
}
}
}
//this is the UML Diagram
//If you need any help regarding this solution ........ please a comment ........... thanks
Get Answers For Free
Most questions answered within 1 hours.