Question
Can you write this in JAVA please Thanks in advance LAB EXERCISES Create interface RegisteredExpat. The interface should define one method named getWorkPermit that accepts
Can you write this in JAVA please Thanks in advance
LAB EXERCISES
Create interface RegisteredExpat. The interface should define one method named getWorkPermit that accepts no arguments, and returns a string.
Modify the ExpatConsultant class to ensure it correctly implements RegisteredExpat along with any other interface it currently implements. The work permit number of an expatriate consultant is obtained by joining the string WP00 with the id number of the expatriate consultant.
Write class LocalResource which extends the Person class. LocalResource exposes the following public methods:
a. LocalResource(String date, String sector)- Actions of the constructor include accepting a date in the format dd/mm/yyyy, initializing the base class, storing the sector and storing an id as a consecutively increasing integer. Note that the constructor must ensure that the date of birth information is recorded. b. getId():Integer - returns the ID of the current instance of LocalResource c. getSector():String returns the sector associated with the current instance of localResource d. getTRN():String returns the trn number of the current instance of LocalResource. The process used to determine the TRN is to add the id to the number 100000000 and then returning the string equivalent. e. Update the NineToFiver class to ensure it properly extends the LocalResource class f. In method getContact() of NineToFiver, remove the comments so that the method returns "Local Employee #"+and the id of the contact.
Write a concrete class LocalConsultant that extends LocalResource, and implements Citizen and Consultant. LocalConsultant exposes the following public methods: a. LocalConsultant(String dob, String sector, double skillPrice, double taxRate)
Saves local instance data populates superclass data and calculates and saves a permit tax for the instance with a value given by taxRate*skillPrice. b. earnFromSkill():double- return the skillPrice for the instance c. getContact():String return the string value obtained by joining the text LocalConsultant# with the id associated with the person d. getPay():double returns the value obtained by subtracting the permit tax from the value earned from the skill.
Assume that all paychecks are ready on the day of birth of the worker (ie all people born on the first of a month get paid on the first of a month, people born on the second get paid on the second, and so on). The SML managers want to track the cash flow in the system. Modify the SML driver class at the comment that is labeled //QUESTION 5 to include the code that will ensure the person list is sorted in ascending order of the day of birth.
Write a comparator for Person named SectorPayOrder that will allow a primary sort in ascending order of sector, and a secondary sort in ascending order of payrate where sectors match.
\} 3 public class SML\{ public static void main(String[] args) throws IOException \{ BufferedReader bufferedReader = new BufferedReader (new InputStreamReader(System. in)); // TODO Auto-generated method stub double taxRate =0.15; Random r= new Random(); //comment the line below to have fun with test cases 4 and 5 r.setseed (7); ArrayList plist= new ArrayList> (); / /MOVE DOWN BEGINNING OF COMMENT BLOCK AFTER DOING WORK TO PASS TEST CASE if (test. equals("CASEO-Q1")) \{ ExpatConsultant ec 0= new ExpatConsultant("2/1/2001", "Computing", 200000, taxRate, 50000); if (ece instanceof RegisteredExpat) System.out. print ln(ec0); else \} System.out. println("RegisteredExpat not implemented"); //MOVE COMMENT BLOCK TO HERE TO PASS CASEO if (test. equals("CASE1-Q2")) \{ ExpatConsultant ec 0 = new ExpatConsultant("2/1/2001", "Computing", 200000, taxRate, 50000); System. out.println(ece.getWorkPermit()+";Birthday:"+eco.getDobDay ()+"/"+ece.getDobMonth()+"/"+eco.getDobYear()); \} //MOVE COMMENT BLOCK TO HERE TO PASS CASE1 taxRate =0.1 if (test. equals("CASE2-Q3")) \{ NineToFiver n50 = new NineToFiver ("2/1/2001", "Computing", 9,17,5, taxRate, 200); if (n50 instanceof LocalResource) \{ System.out.println("LocalResource implemented"); System.out.print ln(n50. getContact() +"; Birthday: "+n50. getDobDay()+"/"+n50.getDobMonth()+"/"+n50.getDobYear ()); System.out.print ln(n50);// "TRN:" +n50.getTRN() +"; working in the "+n50.getSector()+" sector, is paid ")Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started