Question

I have a 2 class code and it works everything is fine and runs as it...

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];
}
}
}

Homework Answers

Answer #1

//this is the UML Diagram

//If you need any help regarding this solution ........ please a comment ........... thanks

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
please fix code to delete by studentname import java.util.Scanner; public class COurseCom666 {     private String...
please fix code to delete by studentname import java.util.Scanner; public class COurseCom666 {     private String courseName;     private String[] students = new String[1];     private int numberOfStudents;     public COurseCom666(String courseName) {         this.courseName = courseName;     }     public String[] getStudents() {         return students;     }     public int getNumberOfStudents() {         return numberOfStudents;     }     public void addStudent(String student) {         if (numberOfStudents == students.length) {             String[] a = new String[students.length + 1];            ...
Please explain code 1 and code 2 for each lines code 1 public class MyQueue {...
Please explain code 1 and code 2 for each lines code 1 public class MyQueue {    public static final int DEFAULT_SIZE = 10;    private Object data[];    private int index; code 2 package test; import java.util.*; /* Class Node */ class Node { protected Object data; protected Node link; /* Constructor */ public Node() { link = null; data = 0; } /* Constructor */ public Node(Object d,Node n) { data = d; link = n; } /*...
PP 8.2 Modify the program from PP 8.1 so that it works for numbers in the...
PP 8.2 Modify the program from PP 8.1 so that it works for numbers in the range between −25 and 25 THIS IS MY CODE! please edit this...Thank you import java.util.Scanner; public class Array { public static void main (String[] args) { Scanner scan = new Scanner (System.in); int[] integs = new int[51]; System.out.println("Enter integers 0-50 [enter -1 to quit]: "); int nums = scan.nextInt(); while (nums != -1 && nums>=0 && nums<=50) { integs[nums]++; nums = scan.nextInt(); } for...
Fix the program: what if the input is three? import java.util.Scanner public class Test { public...
Fix the program: what if the input is three? import java.util.Scanner public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter an integer: "); int m = in.nextInt(); System.out.print("Enter another integer: "); int n = in.nextInt(); System.out.println(m + " " + n); } }
Provide A UML for the Following CODE public class Employee{ public String strName, strSalary; public Employee(){...
Provide A UML for the Following CODE public class Employee{ public String strName, strSalary; public Employee(){    strName = " ";    strSalary = "$0";    } public Employee(String Name, String Salary){    strName = Name;    strSalary = Salary;    } public void setName(String Name){    strName = Name;    } public void setSalary(String Salary){    strSalary = Salary;    } public String getName(){    return strName;    } public String getSalary(){    return strSalary;    } public String...
Identify and explain which type of polymorphism technique is used in the following code A- class...
Identify and explain which type of polymorphism technique is used in the following code A- class Calculator { public void add(int i, int j) { System.out.println("Integer addition"); } public void add(int i, double j) { System.out.println("Integer and double addition"); } public void add(double i, double j) { System.out.println("Double addition"); } } B- public class MyClass { void test(int a) { System.out.println("a: " + a); } void test(int a, int b) { System.out.println("a and b: " + a + "," +...
I am a beginner when it comes to java codeing. Is there anyway this code can...
I am a beginner when it comes to java codeing. Is there anyway this code can be simplified for someone who isn't as advanced in coding? public class Stock { //fields private String name; private String symbol; private double price; //3 args constructor public Stock(String name, String symbol, double price) { this.name = name; this.symbol = symbol; setPrice(price); } //all getters and setters /** * * @return stock name */ public String getName() { return name; } /** * set...
I wrote the following java code with the eclipse ide, which is supposed to report the...
I wrote the following java code with the eclipse ide, which is supposed to report the number of guesses it took to guess the right number between one and five. Can some repost the corrected code where the variable "guess" is incremented such that the correct number of guesses is displayed? please test run the code, not just look at it in case there are other bugs that exist. import java.util.*; public class GuessingGame {    public static final int...
using java LO: (Analyze) Students will fix a loop that runs forever. This program runs the...
using java LO: (Analyze) Students will fix a loop that runs forever. This program runs the countdown sequence for a rocket launch. However, it seems to loop infinitely. Fix the program so it counts down and terminates properly. starter code : import java.util.Scanner; /* * Counts down to a blastoff, starting from a given number. */ public class Countdown {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        int countdown = 0;...
Complete the // TODO sections in the EasyRental class. Create a method that implements an iterative...
Complete the // TODO sections in the EasyRental class. Create a method that implements an iterative sort that sorts the vehicle rentals by color in ascending order (smallest to largest) Create a method to binary search for a vehicle based on a color, that should return the index where the vehicle was found or -1 You are comparing Strings in an object not integers. Ex. If the input is: brown red white blue black -1 the output is: Enter the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT