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 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...
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?
Java please! Write the code in Exercise.java to meet the following problem statement: Write a program...
Java please! Write the code in Exercise.java to meet the following problem statement: Write a program that will print the number of words, characters, and letters read as input. It is guaranteed that each input will consist of at least one line, and the program should stop reading input when either the end of the file is reached or a blank line of input is provided. Words are assumed to be any non-empty blocks of text separated by spaces, and...
JAVA Exercise BasketBall Bar Chart Write a program that allows you to create a bar chart...
JAVA Exercise BasketBall Bar Chart Write a program that allows you to create a bar chart for the active members of a basketball team during a game. (Recall: there are only 5 active players on the court per team in a standard basketball game.) Your program should do the following tasks: • Prompt the user to store the first name of the five players • Prompt the user to enter the points scored by each player a. Use a while...
Can you provide java code for a program that prompts the user by asking "How many...
Can you provide java code for a program that prompts the user by asking "How many one mile races have you ran?". After the user inputs how many one mile races have they run it then prompts the user to input how many seconds it took for them to finish each race. So for example, if the user ran 6 races then the user will have to input 6 race times. Is there a way when you prompt the user...
JAVA code - please answer all prompts as apart of the same java program with Polymorphism...
JAVA code - please answer all prompts as apart of the same java program with Polymorphism Classwork Part A ☑ Create a class Employee. Employees have a name. Also give Employee a method paycheck() which returns a double. For basic employees, paycheck is always 0 (they just get health insurance). Give the class a parameterized constructor that takes the name; Add a method reportDeposit. This method prints a report for the employee with the original amount of the paycheck, the...
JAVA Program: You are a developer for a company that wants to create a new payroll...
JAVA Program: You are a developer for a company that wants to create a new payroll system. Write a program that can be used to calculate an employee’s take home pay. Example - rmckanryProgram1. Creating a flow chart or using stump code to outline your program first may help. Include the following features in the program: Enter employee’s name Enter employee’s base hourly pay Enter the number of hours worked for the week Error if the hours worked exceeds 168...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT