leftalways.blogg.se

Java employee and production worker classes
Java employee and production worker classes









java employee and production worker classes

Output when I run the ProductionWorkerDemo ("Employee Number: " + pw.getEmployeeNumber()) This program uses the Production Worker class that extends the employee The getPayRate method returns the employee's pay The employee's pay rate.ĭecimalFormat dollar = new DecimalFormat("#,#0.00") The getShift method returns the employee's The employee's shift. The setPayRate method sets the employee's pay p The employee's pay rate. The setShift method sets the employee's s The employee's shift. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is selected, and the pay rate The ProductionWorker class should keep data attributes for the following information: Shift number (an integer, such as 1, 2, or 3) Hourly pay rate The workday is divided into two shifts: day and night. Public ProductionWorkerA(String n, String num, String date,ĭate. Private double payRate // The employee's pay rateĮmployee number, hire date, shift, and pay n The employee's num The employee's date The employee's hire sh The employee's rate The employee's pay rate. Private int shift // The employee's shift Constants for the day and night shifts. Public class ProductionWorkerA extends EmployeeA ProductionWorkerA Class import java.util.*

java employee and production worker classes

String str = "Name: " + name + "\nEmployee Number: " ToString A reference to a String representation of The getName method returns the employee's The employee's name.Įmployee's hire The employee's hire date.Įmployee e The string containing an true if e references a valid ID number, The setHireDate method sets the employee's The setEmployeeNumber method sets the e The employee's number. The setName method sets the employee's n The employee's name. Null strings for name, employee number, and hire The no-arg constructor initializes an object with Public Employee(String n, String e, String h) This constructor initializes an object with a name,Įmployee number, and hire n The employee's e The employee's h The employee's hire date. Demonstrate the classes by writing a program that uses a ProductionWorker object Write one or more constructors and the appropriate accessor and mutator methods for the class. The day shift is shift 1 and the night shift is shift 2. The shift field will be an integer value representing the shift the employee works. The workday is divided into two shifts: day and night. The ProductionWorker class should have fields to hold the following information: Next, write a class named ProductionWorker that inherits from the Employee class.

java employee and production worker classes

The class should keep the following information in fields:Įmployee number in the format XXX-L, where each X is a digit within the range 0-9 and the L is a letter within the range A-M. The progam should Design a class named Employee. I am having problems with the output of my program.











Java employee and production worker classes