SlideShare a Scribd company logo
I need help for my next project due next tuesday can you help me in writing this program and
can you make it a simple program easy as possible.
note here are the parameters of the program in bold:
Design a class named Employee. The class should keep the following information in fields:
• Employee name
• Employee 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.
• Hire date
Write one or more constructors and the appropriate accessor and mutator methods for the class.
Next, write a class named Production Worker that extends the Employee class. The
Production Worker class should have fields to hold the following information:
• Shift (an integer)
• Hourly pay rate (a double)
The workday is divided into two shifts: day and night. The shift field will be an integer value
representing the shift that the employee works. The day shift is shift 1 and the night shift is
shift 2. Write one or more constructors and the appropriate accessor and mutator methods for
the class. Demonstrate the classes by writing a program that uses a Production Worker object.
Each class needs a no-arg constructor and a constructor that initializes all fields with data (The
Production Worker class constructor should receive data for the Employee class fields as well)
Create a method within the Employee and Production Worker classes called display Info.
(display Info accepts no arguments and returns void) To display the data for each constructor, the
demonstration class will call the subclass display Info method and it will call the superclass
display Info method. User input is not required for the demonstration class.
Solution
Employe class:
public class Employee
{
public String name;
public String number;
public String hireDate;
public Employee(String n, String num, String hd)
{
name = n;
number = num;
hireDate = hd;
}
public String getName() {
return name;
}
public String getNumber()
{
return number;
}
public String getHireDate()
{
return hireDate;
}
private boolean isValidEmpNum(String e)
{
boolean isValid = true;
int i = 0;
if (e.length() != 5)
{
isValid = false;
}
while (isValid && i < 3)
{
if (!Character.isDigit(e.charAt(i)))
{
isValid = false;
}
i++;
}
while (isValid && i < 4)
{
if (e.charAt(i) != '-')
{
isValid = false;
}
i++;
}
while (isValid && i < 5)
{
if (!Character.isLetter(e.charAt(i)))
{
isValid = false;
}
i++;
}
while (isValid && i < 6)
{
if (e.charAt(4) <= 'A' || e.charAt(4) >= 'M')
{
isValid = false;
}
i++;
}
return isValid;
}
@Override
public String toString()
{
String str = "Name: " + name + " Employee Number: ";
if ("".equals(number))
{
str += "Invalid Employee Number";
}
else {
str += number;
}
str += (" Hire Date: " + hireDate);
return str;
}
}
productionworker class:
import java.text.DecimalFormat;
public class ProductionWorker extends Employee
{
public static int dayShift = 1;
public static int nightShift = 2;
private int shift;
private double payRate;
public String getShift()
{
String shiftTime;
if (shift == 1)
{
shiftTime = "Day";
}
else if (shift == 2)
{
shiftTime = "Night";
}
else if (shift == 3)
{
shiftTime = "Alternating";
}
Else {
shiftTime = "On Call";
}
return shiftTime;
}
public void setShift(int s)
{
shift = s;
}
public double getPayRate()
{
return payRate;
}
public void setPayRate(double rate)
{
payRate = rate;
}
public ProductionWorker(String n, String num, String hd, int sh, double rate) {
super(n, num, hd);
shift = sh;
payRate = rate;
}
public ProductionWorker(String n, String num, String hd) {
super(n, num, hd);
shift = dayShift;
payRate = 0.0;
}
@Override
public String toString()
{
DecimalFormat dollar = new DecimalFormat("#,##0.00");
String str = super.toString();
str += " Shift: ";
if (shift == dayShift)
{
str += "Day";
}
else if (shift == nightShift)
{
str += "Night";
}
else {
str += "Invalid Shift Number";
}
str += (" Hourly Pay Rate: $"+ dollar.format(payRate));
return str;
}
}
workdemo class:
import javax.swing.JOptionPane;
public class WorkDemo
{
public static void main(String[] args)
{
String name;
String number;
String hireDate;
int shift;
double payRate;
double monthlyBonus;
double requiredTrainingHours;
double trainingHoursAttended;
name = JOptionPane.showInputDialog("Enter your name");
number = JOptionPane.showInputDialog("Enter your number (Format: XXX-L)");
hireDate = JOptionPane.showInputDialog("Enter your hire date");
shift = Integer.parseInt(JOptionPane.showInputDialog("Please enter the work shift for the
employee: "
+ "tEnter 1 for the day shift tEnter 2 for the night shift"));
payRate = Double.parseDouble(JOptionPane.showInputDialog("Enter your pay rate"));
monthlyBonus = Double.parseDouble(JOptionPane.showInputDialog("Enter your monthly
bonus"));
requiredTrainingHours = Double.parseDouble(JOptionPane.showInputDialog("Enter your
required traing hours"));
trainingHoursAttended = Double.parseDouble(JOptionPane.showInputDialog("Enter your
training hours attended"));
TeamLeader pw = new TeamLeader(name, number,
hireDate, shift, payRate, monthlyBonus, requiredTrainingHours, trainingHoursAttended);
JOptionPane.showMessageDialog(null,+ " Name: "+ pw.getName() + " . Employee Number:
"
+ pw.getNumber() + " Hire Date: "+ pw.getHireDate() + " Pay Rate: "+ pw.getPayRate() +
" Shift: "
+ pw.getShift() + " Monthly Bonus: "+ pw.getMonthlyBonus() + " Required Training Hours:
"
+ pw.getRequiredTrainingHours() + " Training Hours Attended: "+
pw.getTrainingHoursAttended());
System.exit(0);
}
}

More Related Content

Similar to I need help for my next project due next tuesday can you help me in .pdf

12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
Ashwin Francis
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptx
hara69
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy codeShriKant Vashishtha
 
C++ Function
C++ FunctionC++ Function
C++ FunctionHajar
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9alish sha
 
7 functions
7  functions7  functions
7 functions
MomenMostafa
 
Ch 4
Ch 4Ch 4
Ch 4
AMIT JAIN
 
Basic C Programming Lab Practice
Basic C Programming Lab PracticeBasic C Programming Lab Practice
Basic C Programming Lab Practice
Mahmud Hasan Tanvir
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
TasnimSaimaRaita
 
40+ examples of user defined methods in java with explanation
40+ examples of user defined methods in java with explanation40+ examples of user defined methods in java with explanation
40+ examples of user defined methods in java with explanation
Harish Gyanani
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
Thesis Scientist Private Limited
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
amrit47
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
Animesh Chaturvedi
 
Java căn bản - Chapter3
Java căn bản - Chapter3Java căn bản - Chapter3
Java căn bản - Chapter3Vince Vo
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10alish sha
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
happycocoman
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
Nilesh Dalvi
 
programs of c www.eakanchha.com
 programs of c www.eakanchha.com programs of c www.eakanchha.com
programs of c www.eakanchha.com
Akanchha Agrawal
 

Similar to I need help for my next project due next tuesday can you help me in .pdf (20)

Function in C program
Function in C programFunction in C program
Function in C program
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptx
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy code
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
7 functions
7  functions7  functions
7 functions
 
Ch 4
Ch 4Ch 4
Ch 4
 
Basic C Programming Lab Practice
Basic C Programming Lab PracticeBasic C Programming Lab Practice
Basic C Programming Lab Practice
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
 
40+ examples of user defined methods in java with explanation
40+ examples of user defined methods in java with explanation40+ examples of user defined methods in java with explanation
40+ examples of user defined methods in java with explanation
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
Java căn bản - Chapter3
Java căn bản - Chapter3Java căn bản - Chapter3
Java căn bản - Chapter3
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
programs of c www.eakanchha.com
 programs of c www.eakanchha.com programs of c www.eakanchha.com
programs of c www.eakanchha.com
 

More from amritashinfosalys

Match the type of data with the correct location(B) stackSelect On.pdf
Match the type of data with the correct location(B) stackSelect On.pdfMatch the type of data with the correct location(B) stackSelect On.pdf
Match the type of data with the correct location(B) stackSelect On.pdf
amritashinfosalys
 
In January 2017, Crane Company, a newly formed company, issued 9500 .pdf
In January 2017, Crane Company, a newly formed company, issued 9500 .pdfIn January 2017, Crane Company, a newly formed company, issued 9500 .pdf
In January 2017, Crane Company, a newly formed company, issued 9500 .pdf
amritashinfosalys
 
If the architecture describes the design by specifying gates, flip-fl.pdf
If the architecture describes the design by specifying gates, flip-fl.pdfIf the architecture describes the design by specifying gates, flip-fl.pdf
If the architecture describes the design by specifying gates, flip-fl.pdf
amritashinfosalys
 
how the Central Bank impacts the overall economySolutionthe ce.pdf
how the Central Bank impacts the overall economySolutionthe ce.pdfhow the Central Bank impacts the overall economySolutionthe ce.pdf
how the Central Bank impacts the overall economySolutionthe ce.pdf
amritashinfosalys
 
How do humans localize sound In other words, how does someone with .pdf
How do humans localize sound In other words, how does someone with .pdfHow do humans localize sound In other words, how does someone with .pdf
How do humans localize sound In other words, how does someone with .pdf
amritashinfosalys
 
Explain the ramifications of the changes, and demonstrate that they w.pdf
Explain the ramifications of the changes, and demonstrate that they w.pdfExplain the ramifications of the changes, and demonstrate that they w.pdf
Explain the ramifications of the changes, and demonstrate that they w.pdf
amritashinfosalys
 
Explain and provide examples of how species-specific and environment.pdf
Explain and provide examples of how species-specific and environment.pdfExplain and provide examples of how species-specific and environment.pdf
Explain and provide examples of how species-specific and environment.pdf
amritashinfosalys
 
Each of the following is a function of membranes except sites for spe.pdf
Each of the following is a function of membranes except sites for spe.pdfEach of the following is a function of membranes except sites for spe.pdf
Each of the following is a function of membranes except sites for spe.pdf
amritashinfosalys
 
Develop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdf
Develop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdfDevelop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdf
Develop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdf
amritashinfosalys
 
Devlin Inc produces snack foods such as bagel chips. The company had .pdf
Devlin Inc produces snack foods such as bagel chips. The company had .pdfDevlin Inc produces snack foods such as bagel chips. The company had .pdf
Devlin Inc produces snack foods such as bagel chips. The company had .pdf
amritashinfosalys
 
Choose the one that the correct sequence (going from Mart to finish) .pdf
Choose the one that the correct sequence (going from Mart to finish) .pdfChoose the one that the correct sequence (going from Mart to finish) .pdf
Choose the one that the correct sequence (going from Mart to finish) .pdf
amritashinfosalys
 
Connecting the Concepts Structural Adaptations in Land Plants What .pdf
Connecting the Concepts Structural Adaptations in Land Plants  What .pdfConnecting the Concepts Structural Adaptations in Land Plants  What .pdf
Connecting the Concepts Structural Adaptations in Land Plants What .pdf
amritashinfosalys
 
Business statistics1.How is the trend eliminated in the ratio-to-m.pdf
Business statistics1.How is the trend eliminated in the ratio-to-m.pdfBusiness statistics1.How is the trend eliminated in the ratio-to-m.pdf
Business statistics1.How is the trend eliminated in the ratio-to-m.pdf
amritashinfosalys
 
At the end of Meiosis I for this organism, what is the policy number .pdf
At the end of Meiosis I for this organism, what is the policy number .pdfAt the end of Meiosis I for this organism, what is the policy number .pdf
At the end of Meiosis I for this organism, what is the policy number .pdf
amritashinfosalys
 
Assignment Write a multithreaded Java program that uses either semap.pdf
Assignment Write a multithreaded Java program that uses either semap.pdfAssignment Write a multithreaded Java program that uses either semap.pdf
Assignment Write a multithreaded Java program that uses either semap.pdf
amritashinfosalys
 
African and white abolitionist often did not get along whySoluti.pdf
African and white abolitionist often did not get along whySoluti.pdfAfrican and white abolitionist often did not get along whySoluti.pdf
African and white abolitionist often did not get along whySoluti.pdf
amritashinfosalys
 
What unique properties of the genome do forensic scientists use to g.pdf
What unique properties of the genome do forensic scientists use to g.pdfWhat unique properties of the genome do forensic scientists use to g.pdf
What unique properties of the genome do forensic scientists use to g.pdf
amritashinfosalys
 
what are the five major activities of an operating system in regard .pdf
what are the five major activities of an operating system in regard .pdfwhat are the five major activities of an operating system in regard .pdf
what are the five major activities of an operating system in regard .pdf
amritashinfosalys
 
What are the key components of a typical centralized all-air HVAC sys.pdf
What are the key components of a typical centralized all-air HVAC sys.pdfWhat are the key components of a typical centralized all-air HVAC sys.pdf
What are the key components of a typical centralized all-air HVAC sys.pdf
amritashinfosalys
 
What are lymphoid nodules and where are they located What functions.pdf
What are lymphoid nodules and where are they located What functions.pdfWhat are lymphoid nodules and where are they located What functions.pdf
What are lymphoid nodules and where are they located What functions.pdf
amritashinfosalys
 

More from amritashinfosalys (20)

Match the type of data with the correct location(B) stackSelect On.pdf
Match the type of data with the correct location(B) stackSelect On.pdfMatch the type of data with the correct location(B) stackSelect On.pdf
Match the type of data with the correct location(B) stackSelect On.pdf
 
In January 2017, Crane Company, a newly formed company, issued 9500 .pdf
In January 2017, Crane Company, a newly formed company, issued 9500 .pdfIn January 2017, Crane Company, a newly formed company, issued 9500 .pdf
In January 2017, Crane Company, a newly formed company, issued 9500 .pdf
 
If the architecture describes the design by specifying gates, flip-fl.pdf
If the architecture describes the design by specifying gates, flip-fl.pdfIf the architecture describes the design by specifying gates, flip-fl.pdf
If the architecture describes the design by specifying gates, flip-fl.pdf
 
how the Central Bank impacts the overall economySolutionthe ce.pdf
how the Central Bank impacts the overall economySolutionthe ce.pdfhow the Central Bank impacts the overall economySolutionthe ce.pdf
how the Central Bank impacts the overall economySolutionthe ce.pdf
 
How do humans localize sound In other words, how does someone with .pdf
How do humans localize sound In other words, how does someone with .pdfHow do humans localize sound In other words, how does someone with .pdf
How do humans localize sound In other words, how does someone with .pdf
 
Explain the ramifications of the changes, and demonstrate that they w.pdf
Explain the ramifications of the changes, and demonstrate that they w.pdfExplain the ramifications of the changes, and demonstrate that they w.pdf
Explain the ramifications of the changes, and demonstrate that they w.pdf
 
Explain and provide examples of how species-specific and environment.pdf
Explain and provide examples of how species-specific and environment.pdfExplain and provide examples of how species-specific and environment.pdf
Explain and provide examples of how species-specific and environment.pdf
 
Each of the following is a function of membranes except sites for spe.pdf
Each of the following is a function of membranes except sites for spe.pdfEach of the following is a function of membranes except sites for spe.pdf
Each of the following is a function of membranes except sites for spe.pdf
 
Develop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdf
Develop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdfDevelop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdf
Develop a detailed Compliance budget for fiscal year 2015-16 for a 1.pdf
 
Devlin Inc produces snack foods such as bagel chips. The company had .pdf
Devlin Inc produces snack foods such as bagel chips. The company had .pdfDevlin Inc produces snack foods such as bagel chips. The company had .pdf
Devlin Inc produces snack foods such as bagel chips. The company had .pdf
 
Choose the one that the correct sequence (going from Mart to finish) .pdf
Choose the one that the correct sequence (going from Mart to finish) .pdfChoose the one that the correct sequence (going from Mart to finish) .pdf
Choose the one that the correct sequence (going from Mart to finish) .pdf
 
Connecting the Concepts Structural Adaptations in Land Plants What .pdf
Connecting the Concepts Structural Adaptations in Land Plants  What .pdfConnecting the Concepts Structural Adaptations in Land Plants  What .pdf
Connecting the Concepts Structural Adaptations in Land Plants What .pdf
 
Business statistics1.How is the trend eliminated in the ratio-to-m.pdf
Business statistics1.How is the trend eliminated in the ratio-to-m.pdfBusiness statistics1.How is the trend eliminated in the ratio-to-m.pdf
Business statistics1.How is the trend eliminated in the ratio-to-m.pdf
 
At the end of Meiosis I for this organism, what is the policy number .pdf
At the end of Meiosis I for this organism, what is the policy number .pdfAt the end of Meiosis I for this organism, what is the policy number .pdf
At the end of Meiosis I for this organism, what is the policy number .pdf
 
Assignment Write a multithreaded Java program that uses either semap.pdf
Assignment Write a multithreaded Java program that uses either semap.pdfAssignment Write a multithreaded Java program that uses either semap.pdf
Assignment Write a multithreaded Java program that uses either semap.pdf
 
African and white abolitionist often did not get along whySoluti.pdf
African and white abolitionist often did not get along whySoluti.pdfAfrican and white abolitionist often did not get along whySoluti.pdf
African and white abolitionist often did not get along whySoluti.pdf
 
What unique properties of the genome do forensic scientists use to g.pdf
What unique properties of the genome do forensic scientists use to g.pdfWhat unique properties of the genome do forensic scientists use to g.pdf
What unique properties of the genome do forensic scientists use to g.pdf
 
what are the five major activities of an operating system in regard .pdf
what are the five major activities of an operating system in regard .pdfwhat are the five major activities of an operating system in regard .pdf
what are the five major activities of an operating system in regard .pdf
 
What are the key components of a typical centralized all-air HVAC sys.pdf
What are the key components of a typical centralized all-air HVAC sys.pdfWhat are the key components of a typical centralized all-air HVAC sys.pdf
What are the key components of a typical centralized all-air HVAC sys.pdf
 
What are lymphoid nodules and where are they located What functions.pdf
What are lymphoid nodules and where are they located What functions.pdfWhat are lymphoid nodules and where are they located What functions.pdf
What are lymphoid nodules and where are they located What functions.pdf
 

Recently uploaded

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

I need help for my next project due next tuesday can you help me in .pdf

  • 1. I need help for my next project due next tuesday can you help me in writing this program and can you make it a simple program easy as possible. note here are the parameters of the program in bold: Design a class named Employee. The class should keep the following information in fields: • Employee name • Employee 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. • Hire date Write one or more constructors and the appropriate accessor and mutator methods for the class. Next, write a class named Production Worker that extends the Employee class. The Production Worker class should have fields to hold the following information: • Shift (an integer) • Hourly pay rate (a double) The workday is divided into two shifts: day and night. The shift field will be an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator methods for the class. Demonstrate the classes by writing a program that uses a Production Worker object. Each class needs a no-arg constructor and a constructor that initializes all fields with data (The Production Worker class constructor should receive data for the Employee class fields as well) Create a method within the Employee and Production Worker classes called display Info. (display Info accepts no arguments and returns void) To display the data for each constructor, the demonstration class will call the subclass display Info method and it will call the superclass display Info method. User input is not required for the demonstration class. Solution Employe class: public class Employee { public String name; public String number; public String hireDate; public Employee(String n, String num, String hd) { name = n;
  • 2. number = num; hireDate = hd; } public String getName() { return name; } public String getNumber() { return number; } public String getHireDate() { return hireDate; } private boolean isValidEmpNum(String e) { boolean isValid = true; int i = 0; if (e.length() != 5) { isValid = false; } while (isValid && i < 3) { if (!Character.isDigit(e.charAt(i))) { isValid = false; } i++; } while (isValid && i < 4) { if (e.charAt(i) != '-') { isValid = false; }
  • 3. i++; } while (isValid && i < 5) { if (!Character.isLetter(e.charAt(i))) { isValid = false; } i++; } while (isValid && i < 6) { if (e.charAt(4) <= 'A' || e.charAt(4) >= 'M') { isValid = false; } i++; } return isValid; } @Override public String toString() { String str = "Name: " + name + " Employee Number: "; if ("".equals(number)) { str += "Invalid Employee Number"; } else { str += number; } str += (" Hire Date: " + hireDate); return str; } }
  • 4. productionworker class: import java.text.DecimalFormat; public class ProductionWorker extends Employee { public static int dayShift = 1; public static int nightShift = 2; private int shift; private double payRate; public String getShift() { String shiftTime; if (shift == 1) { shiftTime = "Day"; } else if (shift == 2) { shiftTime = "Night"; } else if (shift == 3) { shiftTime = "Alternating"; } Else { shiftTime = "On Call"; } return shiftTime; } public void setShift(int s) { shift = s; } public double getPayRate() { return payRate; }
  • 5. public void setPayRate(double rate) { payRate = rate; } public ProductionWorker(String n, String num, String hd, int sh, double rate) { super(n, num, hd); shift = sh; payRate = rate; } public ProductionWorker(String n, String num, String hd) { super(n, num, hd); shift = dayShift; payRate = 0.0; } @Override public String toString() { DecimalFormat dollar = new DecimalFormat("#,##0.00"); String str = super.toString(); str += " Shift: "; if (shift == dayShift) { str += "Day"; } else if (shift == nightShift) { str += "Night"; } else { str += "Invalid Shift Number"; } str += (" Hourly Pay Rate: $"+ dollar.format(payRate)); return str; } }
  • 6. workdemo class: import javax.swing.JOptionPane; public class WorkDemo { public static void main(String[] args) { String name; String number; String hireDate; int shift; double payRate; double monthlyBonus; double requiredTrainingHours; double trainingHoursAttended; name = JOptionPane.showInputDialog("Enter your name"); number = JOptionPane.showInputDialog("Enter your number (Format: XXX-L)"); hireDate = JOptionPane.showInputDialog("Enter your hire date"); shift = Integer.parseInt(JOptionPane.showInputDialog("Please enter the work shift for the employee: " + "tEnter 1 for the day shift tEnter 2 for the night shift")); payRate = Double.parseDouble(JOptionPane.showInputDialog("Enter your pay rate")); monthlyBonus = Double.parseDouble(JOptionPane.showInputDialog("Enter your monthly bonus")); requiredTrainingHours = Double.parseDouble(JOptionPane.showInputDialog("Enter your required traing hours")); trainingHoursAttended = Double.parseDouble(JOptionPane.showInputDialog("Enter your training hours attended")); TeamLeader pw = new TeamLeader(name, number, hireDate, shift, payRate, monthlyBonus, requiredTrainingHours, trainingHoursAttended); JOptionPane.showMessageDialog(null,+ " Name: "+ pw.getName() + " . Employee Number: " + pw.getNumber() + " Hire Date: "+ pw.getHireDate() + " Pay Rate: "+ pw.getPayRate() + " Shift: " + pw.getShift() + " Monthly Bonus: "+ pw.getMonthlyBonus() + " Required Training Hours: " + pw.getRequiredTrainingHours() + " Training Hours Attended: "+