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.   Attempted code: class LocalResource extends Person {     private static int idCounter = 0;     private int id;     private String sector;     private String trn;     // Constructor for LocalResource class     // Accepts a date in the format "dd/mm/yyyy", initializes the base class,     // stores the sector, and stores an ID as a consecutively increasing integer     public LocalResource(String date, String sector) {         super(); // Call the default constructor of the Person class for reference         String[] parts = date.split("/");         super.setDob(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]));         this.sector = sector;         this.id = ++idCounter;         this.trn = getTRN();     }     // Returns the sector associated with the current instance of LocalResource     public String getSector() {         return sector;     }     // Returns the ID of the current instance of LocalResource     public int getId() {         return id;     }        public String getTRN() {         return String.valueOf(id + 100000000);     }     // Returns a string representation of the LocalResource object     // in the format "[dd]LocalResource#id to be paid $pay in the sector sector"     public String toString() {         NumberFormat formatter = NumberFormat.getCurrencyInstance();         return "[" + super.getDobDay() + "]" + getContact() + " to be paid " +                 formatter.format(getPay()) + " in the " + sector + " sector";     }     // Abstract method from the Person class that must be implemented     // Returns the pay for the current instance of LocalResource     @Override     public double getPay() {         return 0;     }        @Override     public String getContact() {         return "LocalResource#" + id;     } } class LocalConsultant extends LocalResource implements Citizen, Consultant {     private double skillPrice;     private double permitTax;       public LocalConsultant(String dob, String sector, double skillPrice, double taxRate)     {         super(sector, dob);         this.skillPrice = skillPrice;         this.permitTax = taxRate * skillPrice;     }       public double earnFromSkill()     {         return skillPrice;     }       public String getContact()     {         return "LocalConsultant#" + getId();     }       public double getPay()     {         return earnFromSkill() - permitTax;     } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.

  1. 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.
    •  
    • Attempted code:
    • class LocalResource extends Person {
          private static int idCounter = 0;
          private int id;
          private String sector;
          private String trn;

          // Constructor for LocalResource class
          // Accepts a date in the format "dd/mm/yyyy", initializes the base class,
          // stores the sector, and stores an ID as a consecutively increasing integer
          public LocalResource(String date, String sector) {
              super(); // Call the default constructor of the Person class for reference
              String[] parts = date.split("/");
              super.setDob(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]));
              this.sector = sector;
              this.id = ++idCounter;
              this.trn = getTRN();
          }

          // Returns the sector associated with the current instance of LocalResource
          public String getSector() {
              return sector;
          }

          // Returns the ID of the current instance of LocalResource
          public int getId() {
              return id;
          }

        

          public String getTRN() {
              return String.valueOf(id + 100000000);
          }

          // Returns a string representation of the LocalResource object
          // in the format "[dd]LocalResource#id to be paid $pay in the sector sector"
          public String toString() {
              NumberFormat formatter = NumberFormat.getCurrencyInstance();
              return "[" + super.getDobDay() + "]" + getContact() + " to be paid " +
                      formatter.format(getPay()) + " in the " + sector + " sector";
          }

          // Abstract method from the Person class that must be implemented
          // Returns the pay for the current instance of LocalResource
          @Override
          public double getPay() {
              return 0;
          }

        
          @Override
          public String getContact() {
              return "LocalResource#" + id;
          }
      }

      class LocalConsultant extends LocalResource implements Citizen, Consultant {
          private double skillPrice;
          private double permitTax;
       
          public LocalConsultant(String dob, String sector, double skillPrice, double taxRate)
          {
              super(sector, dob);
              this.skillPrice = skillPrice;
              this.permitTax = taxRate * skillPrice;
          }
       
          public double earnFromSkill()
          {
              return skillPrice;
          }
       
          public String getContact()
          {
              return "LocalConsultant#" + getId();
          }
       
          public double getPay()
          {
              return earnFromSkill() - permitTax;
          }
      }

(217) C
78°F
Partly sunny
sml x
Answer y! LocalRe y! LocalRe y! LocalRe
✰ hackerrank.com/contests/comp1161-lab4-23/challenges/sml-worx-23/problem
199
200
201
202
203
204
205 }
Hi, Assi y! sml_wo y! Create
}
// Returns a string representation of the contact information for the current
// instance of LocalResource in the format "LocalResource#id"
@Override
public String getContact() {
return "LocalResource#" + id;
217
218 public double earnFromSkill() {
219
return permitTax;
220 }
221
222 public String getContact() {
223
224 }
225
226 public double getPay () {
227
228 }
229
230 }
231
232
233
234
235
236 class PayOrder implements Comparator<Person> {
237
public int compare (Person pl, Person p2)
238
{
229
return "LocalConsultant#" + getId();
return earnFromSkill()-permitTax;
206
207 class LocalConsultant extends LocalResource implements Citizen, Consultant {
208
209 private String skill;
210 private double permitTax;
211
212 public LocalConsultant (String dob, String sector, double skillPrice, double taxRate, String skill) {
213
super("", "", dob, sector);
214
this.skill skill;
215
this.permitTax = taxRate * skillPrice;
216 }
if (n1 go+Pay() >n2 getPay())
HII B-Rhym y! chatgp
O Search
■
ChatGP
H
Micros y! java co
ǝs Compa
Answer +
0
7:24 AM
2/14/2023
X
...
Transcribed Image Text:(217) C 78°F Partly sunny sml x Answer y! LocalRe y! LocalRe y! LocalRe ✰ hackerrank.com/contests/comp1161-lab4-23/challenges/sml-worx-23/problem 199 200 201 202 203 204 205 } Hi, Assi y! sml_wo y! Create } // Returns a string representation of the contact information for the current // instance of LocalResource in the format "LocalResource#id" @Override public String getContact() { return "LocalResource#" + id; 217 218 public double earnFromSkill() { 219 return permitTax; 220 } 221 222 public String getContact() { 223 224 } 225 226 public double getPay () { 227 228 } 229 230 } 231 232 233 234 235 236 class PayOrder implements Comparator<Person> { 237 public int compare (Person pl, Person p2) 238 { 229 return "LocalConsultant#" + getId(); return earnFromSkill()-permitTax; 206 207 class LocalConsultant extends LocalResource implements Citizen, Consultant { 208 209 private String skill; 210 private double permitTax; 211 212 public LocalConsultant (String dob, String sector, double skillPrice, double taxRate, String skill) { 213 super("", "", dob, sector); 214 this.skill skill; 215 this.permitTax = taxRate * skillPrice; 216 } if (n1 go+Pay() >n2 getPay()) HII B-Rhym y! chatgp O Search ■ ChatGP H Micros y! java co ǝs Compa Answer + 0 7:24 AM 2/14/2023 X ...
public class LocalResource extends Person {
private static int idCounter = 0;
private int id;
private String sector;
private String trn;
}
}
public LocalResource(String firstName, String lastName, String trn, String date, String sector) {|
super (firstName, lastName, date);
this.trn = trn;
this.sector = sector;
this.id = ++idCounter;
public String getSector() {
return sector;
}
public void setSector (String sector) {
this.sector = sector;
}
public int getId() {
return id;
}
public String getTRN () {
}
return Integer.toString(id +100000000);
public String getContact() {
return "LocalResource#" + Integer.toString(id);
}
Transcribed Image Text:public class LocalResource extends Person { private static int idCounter = 0; private int id; private String sector; private String trn; } } public LocalResource(String firstName, String lastName, String trn, String date, String sector) {| super (firstName, lastName, date); this.trn = trn; this.sector = sector; this.id = ++idCounter; public String getSector() { return sector; } public void setSector (String sector) { this.sector = sector; } public int getId() { return id; } public String getTRN () { } return Integer.toString(id +100000000); public String getContact() { return "LocalResource#" + Integer.toString(id); }
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education