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...
In Java ReWrite the for loop program code example 3, above as a while loop. Code...
In Java ReWrite the for loop program code example 3, above as a while loop. Code Example 3 – Try it import java.util.Scanner; public static void main(String args[]) { int count = 0; int maxNumber = 0; int enteredNumber = -9999999; System.out.println("This program determines which entered number is the largest "); System.out.println("Enter count of numbers to check: "); Scanner scanIn = new Scanner(System.in); double count = scanIn.nextDouble(); scanIn.close(); // Print out message – input number – compare to see if...
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 + "," +...
2.) Analyze the modified Java code PrimeFinderInterupt Make this program to RUN and provide a screenshot...
2.) Analyze the modified Java code PrimeFinderInterupt Make this program to RUN and provide a screenshot of the output Describe the additional functionality of the PrimeFinderInterrupt NOTE IF your original PrimeFinder ran faster than 7 seconds, change the code line: "if (++index > 7 )" to have a number less than the time to run your original code. _______________________________________________________________ Below is the "PrimeFinderInterupt" java code: package com.java24hours; public class PrimeFinderInterrupt implements Runnable { Thread go; StringBuffer primes = new StringBuffer();...
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;    }   ...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT