Question

In: Computer Science

Please can you draw a flow chart for the following code : Program code for Payroll,java:...

Please can you draw a flow chart for the following code :

Program code for Payroll,java:

public class Payroll
{

public Payroll(String name,int ID,double payRate)
{
this.name=name;
this.ID=ID;
this.payRate=payRate;
}

private String name;
private double payRate,hrWorked;
private int ID;

public Payroll()
{
name="John Doe";
ID=9999;
payRate=15.0;
hrWorked=40;
}

public String getName()
{
return name;
}

public int getID()
{
return ID;
}

public void setPayRate(int payRate)
{
this.payRate=payRate;
}

public void setHrWorked(double hrWorked)
{
this.hrWorked=hrWorked;
}

public double getPayRate()
{
return payRate;
}

public double getHrWorked()
{
return hrWorked;
}

public double grossPay()
{
double grosspay=hrWorked*payRate;
return grosspay;
}

}

Program code for PayrollClient.java:

import java.util.Scanner;
class main
{
public static void main(String [] args)
{
Scanner read=new Scanner(System.in);
System.out.print("\nEnter Name:");
String name=read.next();
System.out.print("\nEnter ID:");
int ID=read.nextInt();
System.out.print("\nEnter Payrate:");
double payRate=read.nextDouble();

Payroll obj1=new Payroll(name,ID,payRate);

System.out.print("\nEnter Hours worked:");
double hrWorked=read.nextDouble();
obj1.setHrWorked(hrWorked);

Payroll obj2=new Payroll();

System.out.println("Employee details are:");
System.out.println("Name\t ID\tPayRate\tHoursWorked\tGrossPay");

System.out.println(obj1.getName()+" "+obj1.getID()+"\t"+obj1.getPayRate()+"\t"+obj1.getHrWorked()+"\t\t"+obj1.grossPay());
System.out.println(obj2.getName()+" "+obj2.getID()+"\t"+obj2.getPayRate()+"\t"+obj2.getHrWorked()+"\t\t"+obj2.grossPay());
}
}

Solutions

Expert Solution

Answer-

Flow Chart for the  Payroll.java ⇒

There are five function or class used in this flow Chart-

  • Payroll()
  • getID()
  • setPayRate()
  • getHrWorked()
  • grossPay()

Payroll()-

getID()-

setPayRate()-

getHrWorked()-

grossPay()-

Flow Chart for the  PayrollClient.java-

Note- Please do upvote, if any problem then comment in box sure I will help.


Related Solutions

Please drow Flow chart The program you will be writing displays a weekly payroll report. A...
Please drow Flow chart The program you will be writing displays a weekly payroll report. A loop in the program should ask the user for the employee’s number, employee’s last name, number of hours worked, hourly pay rate, state tax, and federal tax rate. After the data is entered and the user hits the enter key, the program will calculate gross and net pay then displays employee’s payroll information as follows and asks for the next employees’ information. if the...
PLEASE CODE IN JAVA In this assignment you will write a program in that can figure...
PLEASE CODE IN JAVA In this assignment you will write a program in that can figure out a number chosen by a human user. The human user will think of a number between 1 and 100. The program will make guesses and the user will tell the program to guess higher or lower.                                                                   Requirements The purpose of the assignment is to practice writing functions. Although it would be possible to write the entire program in the main function, your...
JAVA - PLEASE COMMENT CODE - THANK YOU: Implement a program that can input an expression...
JAVA - PLEASE COMMENT CODE - THANK YOU: Implement a program that can input an expression in postfix notation and output its value.
Draw a flow chart for a program that will get the name and final exam results...
Draw a flow chart for a program that will get the name and final exam results for all FBTOO15 students (474); and calculate the total scores for all students. After all results were entered, the average results would be calculated and displayed on screen.
I need a flow chart built in raptor and the Java source code in the source...
I need a flow chart built in raptor and the Java source code in the source folder (src) Please fully document the program: add comments to describe all major parts of the solution. SO that I can understand how and why the code was built that way. Problem specifications: -The TSA want you to design and code a program that will be used to screen travelers through AirportX. When a traveler arrives at the airport, he/she is required to go...
can you please give me an example of a state diagram and a flow chart for...
can you please give me an example of a state diagram and a flow chart for a simple program?
Draw a Flow chart and write a C++ program to solve the quadratic equation ax^2 +...
Draw a Flow chart and write a C++ program to solve the quadratic equation ax^2 + bx + c = 0 where coefficient a is not equal to 0. The equation has two real roots if its discriminator d = b2 – 4ac is greater or equal to zero. The program gets the three coefficients a, b, and c, computes and displays the two real roots (if any). It first gets and tests a value for the coefficient a. if...
can you please convert this python code into java? Python code is as shown below: #...
can you please convert this python code into java? Python code is as shown below: # recursive function def row_puzzle_rec(row, pos, visited):    # if the element at the current position is 0 we have reached our goal    if row[pos] == 0:        possible = True    else:        # make a copy of the visited array        visited = visited[:]        # if the element at the current position has been already visited then...
write the PsuedoCode and the flow chart of the following: 1. draw a deck of cards...
write the PsuedoCode and the flow chart of the following: 1. draw a deck of cards from a standard deck of 52 cards until the queen of hearts is draw. how many cards did you draw?
Can someone please complete the following code(Java). The stuff in comments are the things you need...
Can someone please complete the following code(Java). The stuff in comments are the things you need to look at and code that package mini2; import static mini2.State.*; /** * Utility class containing the key algorithms for moves in the * a yet-to-be-determined game. */ public class PearlUtil { private PearlUtil() { // disable instantiation } /**    * Replaces all PEARL states with EMPTY state between indices    * start and end, inclusive.    * @param states    * any...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT