Design a class names Employee. The class should keep the following information i
ID: 3642475 • Letter: D
Question
Design a class names Employee. The class should keep the following information in fields:Explanation / Answer
Ok so some of your instructions dont really make much sense. But its cool I brogrammed this for you anyways. it seems your professor just wants to see you use some overrides, class objects, and inheritence. so here is what I did. You need to make some changes to make it "yours" :) //////////////// Driver.java //////////////////////// public class Driver { public static void main(String[] args) { Employee pass = new Employee("123-A", "Alex", "May"); Employee fail = new Employee("123-X", "Matthew", "April"); ProductionWorker p1 = new ProductionWorker("123-B", "Slim Shady", "May", 1, 5.00); ProductionWorker f1 = new ProductionWorker("12234", "TuPac", "October", 2, 10.00); System.out.println(pass.toString() + " isValidEmpNumber: " + pass.isValidEmpNum(pass._EmployeeNumber)); System.out.println(fail.toString() + " isValidEmpNumber: " + fail.isValidEmpNum(fail._EmployeeNumber)); System.out.println(p1.toString() + " isValidEmpNumber: " + p1.isValidEmpNum(p1._EmployeeNumber)); System.out.println(f1.toString() + " isValidEmpNumber: " + f1.isValidEmpNum(f1._EmployeeNumber)); } } /////////////////// Employee.java ////////////////// public class Employee { public String _Name; public String _EmployeeNumber; public String _HireDate; public Employee() { /* empty constructor */ } public Employee(String num, String name, String date) { this._Name = name; this._EmployeeNumber = num; this._HireDate = date; } public void setName(String value) { _Name = value; } public void setEmployeeNumbewr(String value) { _EmployeeNumber = value; } public void setHireDate(String value) { _HireDate = value; } public String getName() { return _Name; } public String getEmployeeNumber() { return _EmployeeNumber; } public String getHireDate() { return _HireDate; } public boolean isValidEmpNum(String value) { for(int i = 0; i 'M' || value.length() > 5 || value.charAt(3) != '-') /* really we are checking the format no chars in first three, must have a dash, and nothing higher then 'M' */ { return false; } } return true; } @Override public String toString() { return _Name + " " + _EmployeeNumber + " " + _HireDate; } } ////////////// ProductionWorker.java ///////////////// public class ProductionWorker extends Employee { public int shift; public double payRate; public final int DAY_SHIFT = 1; public final int NIGHT_SHIFT = 2; public ProductionWorker(String num, String name, String date, int sh, double rate) { this._Name = name; this._EmployeeNumber = num; this._HireDate = date; this.shift = sh; this.payRate = rate; } public void setShift(int sh) { shift = sh; } public void setPayRate(double rate) { payRate = rate; } public int getShift() { return shift; } public double getPayRate() { return payRate; } @Override public String toString() { return _Name + " " + _EmployeeNumber + " " + _HireDate + " " + shift + " " + payRate; } }Related 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.