Create a program using JAVA TEXTPAD that Designs a class named Payroll that cont
ID: 3565798 • Letter: C
Question
Create a program using JAVA TEXTPAD that Designs a class named Payroll that contains the following data fields, constructor and methods.
The data fields:
The constructor and other methods:
1.Draw the UML diagram for the Payroll class.
2.Implement the Payroll class.
3.Write a test program to
a)create 3 Payroll objects and print numberOfObjects after each object created.
b)use the mutator methods to assign the data to hrWorked.
c)print (a method MUST be used) the information for each employee: name, ID, pay rate, hours worked and gross pay.
Explanation / Answer
import java.util.Scanner; //program uses class SCanner public class PayrollPart2 { public static void main( String[] args ) { Scanner input = new Scanner( System.in ); // create Scanner to obtain input from command window // variables char name; // divisions's name int number1; // number of employees in the division double number2; // average salary for the employees double product; // total division payroll //prompt user to input division name System.out.print( "Enter Division's name, type stop to exit: "); String divisionName = input.nextLine(); //read line of text while(!("stop".equals(divisionName))) { //prompt user for number of employees in the division System.out.print( "Enter the number of employees in the division: "); //read number of employees from user's input number1 = input.nextInt(); while (number1Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.