Question: Could you create a UML flowchart for the following code, Preferably in the software DIA , Microsoft Word or Paper whichever is easier for you.
Could you create a UML flowchart for the following code, Preferably in the software DIA , Microsoft Word or Paper whichever is easier for you.
Examples of the UML im looking for (this is not related to the question its just an example)

Here is the code
public class Payroll {
private int[] employeeID = {5658845, 4520125, 7895122, 8477541, 8451277, 1302850, 7580489 };
//Number of hours worked by each employee private int[] hours = new int[7];
//Employee's hourly pay rate private double[] payRate = new double[7];
//Employee's gross wages. private double[] wages = new double[7];
//accessor and mutator methods
//returns id of index public int getEmployeeID(int index) { return employeeID[index]; }
//returns hours public int getHours(int index) { return hours[index]; }
//returns payrate public double getPayRate(int index) { return payRate[index]; } //returns wages public double getWages(int index) { return wages[index]; }
//sets ID public void setEmployeeID(int index, int ID) { employeeID[index] = ID; }
//Sets Hours public void setHours(int index, int hour) { hours[index] = hour; }
//Sets Rate public void setPayRate(int index, double payrate) { payRate[index] = payrate; }
//Sets Wages public void setWages(int index, double wage) { wages[index] = wage; }
//Gross pay for each employee with identification
public double calculateGrossPay(int theEmployeeID) { double grossPay = 0; int employeeIndex = - 1; //index of the employee for (int i = 0; i
int h = hours[employeeIndex]; double r = payRate[employeeIndex]; grossPay = (h * r); //calculate the gross pay } return grossPay; } }
_______________________________________
payRollTest
/**
* Modified java program that prompts user to enter
* hours and pay rate and then prints the gross pay
* to console for each employee
* */
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Scanner;
public class payRollTest {
public static void main(String[] args) {
//System.out.println(" Payroll Application ");
Payroll payroll = new Payroll();
Scanner kb = new Scanner(System.in);
//Variable declaration
int hours;
double payRate;
double wages;
// Create an ArrayList to hold some names.
ArrayList
employeeID.add("5658845");
employeeID.add("4520125");
employeeID.add("7895122");
employeeID.add("8777541");
employeeID.add("8451277");
employeeID.add("1302850");
employeeID.add("7580489");
//Loop repeats for all 7 employees
for (int i = 0; i
//System.out.println("Employee :" + (i + 1) );
do {
//get the hours
System.out.println("The first element is: " + employeeID.get(i));
System.out.println("Enter the hours worked by employee number " + employeeID.get(i)+":");
hours = Integer.parseInt(kb.nextLine());
}
while (hours
payroll.setHours(i, hours);
do {
//get the payrate
System.out.println("Enter the hourly pay rate for employee number :" + employeeID.get(i)+":" );
payRate = Double.parseDouble(kb.nextLine());
//print error message if rate is
if(payRate
System.out.println("ERROR: Enter 6.00 or greater for pay rate: ");
}while (payRate
payroll.setPayRate(i, payRate);
int empid = payroll.getEmployeeID(i);
wages = payroll.calculateGrossPay(empid);
payroll.setWages(i, wages);
}
//create a instance of decimal format to display comma
//separated values
DecimalFormat df=new DecimalFormat("##,###.00");
//Display each employee's identification number
//and gross wages.
for (int i = 0; i
System.out.println("\tEmployee ID: " + payroll.getEmployeeID(i));
System.out.println("\tGross pay: $" + df.format(payroll.getWages(i)));
}
//Exit program
System.exit(0);
}
}
TestResultsDemo :Str process Input): int start TestResults testScore start es tResults (r:int rintGrade() void +getGrade) String output prompt start testScore-processinput) input testScore test Score-r if test Score 60 create TestResults as test.l using testscore return testScore stop true output "Your grade is F" false testScore
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
