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

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...
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...
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...
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 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...
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...
I need the Java Code and Flowchart for the following program: Suppose you are given a...
I need the Java Code and Flowchart for the following program: Suppose you are given a 6-by-6 matrix filled with 0s and 1s. All rows and all columns have an even number of 1s. Let the user flip one cell (i.e., flip from 1 to 0 or from 0 to 1) and write a program to find which cell was flipped. Your program should prompt the user to enter a 6-by-6 array with 0s and 1s and find the first...
Can you please add comments to this code? JAVA Code: import java.util.ArrayList; public class Catalog {...
Can you please add comments to this code? JAVA Code: import java.util.ArrayList; public class Catalog { String catalog_name; ArrayList<Item> list; Catalog(String cs_Gift_Catalog) { list=new ArrayList<>(); catalog_name=cs_Gift_Catalog; } String getName() { int size() { return list.size(); } Item get(int i) { return list.get(i); } void add(Item item) { list.add(item); } } Thanks!
Please show screenshot outputs and fully functional code for the Java program. Write the following methods...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods to   1) read the content of an array of 5 doubles public static double[] readingArray() 2) find and print:the smallest element in an array of 5 double public static void smallest(double [] array) 3) find and print:the largest element in an array of 5 doubles pubic static void largest (double [] array) In the main method - invoke readingArray and enter the following numbers...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT