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 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; } /*...
This assignment is an individual assignment. For Questions 1-3: consider the following code: public class A...
This assignment is an individual assignment. For Questions 1-3: consider the following code: public class A { private int number; protected String name; public double price; public A() { System.out.println(“A() called”); } private void foo1() { System.out.println(“A version of foo1() called”); } protected int foo2() { Sysem.out.println(“A version of foo2() called); return number; } public String foo3() { System.out.println(“A version of foo3() called”); Return “Hi”; } }//end class A public class B extends A { private char service; public B()...
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];            ...
Question: Squares. Write a program class named SquareDisplay that asks the user for a positive integer...
Question: Squares. Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using the character ‘X’. The number entered by the user will be the length of each side of the square. For example, if the user enters 5, the program should display the following:       XXXXX       XXXXX       XXXXX       XXXXX       XXXXX INPUT and PROMPTS. The program prompts for an integer as follows: "Enter...
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...
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 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...
<<<<<<<< I need only the UML diagram for ALL classes.Java???????????? public class House {    private...
<<<<<<<< I need only the UML diagram for ALL classes.Java???????????? public class House {    private int houseNumber;    private int bedrooms;    private int sqFeet;    private int year;    private int cost;    public House(int houseNumber,int bedrooms,int sqFeet, int year, int cost)    {        this.houseNumber = houseNumber;        this.bedrooms = bedrooms;        this.sqFeet = sqFeet;        this.year = year;        this.cost = cost;    }    public int getHouseNumber()    {        return houseNumber;    }   ...
Please solve this problem in java. import java.util.Arrays; public class PriorityQueue { /* This class is...
Please solve this problem in java. import java.util.Arrays; public class PriorityQueue { /* This class is finished for you. */ private static class Customer implements Comparable { private double donation; public Customer(double donation) { this.donation = donation; } public double getDonation() { return donation; } public void donate(double amount) { donation += amount; } public int compareTo(Customer other) { double diff = donation - other.donation; if (diff < 0) { return -1; } else if (diff > 0) { return...
Hello. I have an assignment that is completed minus one thing, I can't get the resize...
Hello. I have an assignment that is completed minus one thing, I can't get the resize method in Circle class to actually resize the circle in my TestCircle claass. Can someone look and fix it? I would appreciate it! If you dont mind leaving acomment either in the answer or just // in the code on what I'm doing wrong to cause it to not work. That's all I've got. Just a simple revision and edit to make the resize...