Question: PLEASE HELP ASAP! MATCHING QUESTION!! Each choice is used atmost once. /** A unit in an organization. */ [3] public interface Unit { [4] public

PLEASE HELP ASAP! MATCHING QUESTION!!

PLEASE HELP ASAP! MATCHING QUESTION!! Each choice is used atmost once. /**A unit in an organization. */ [3] public interface Unit { [4]

Each choice is used atmost once. /** A unit in an organization. */ [3] public interface Unit { [4] public double ycomp(); // Yearly compensation [5] public String toString(); [6]} [7] /** A person. */ [8] public class Person implements Unit { [9] private String _name; // Name [10] private String _title; // Title is "BigBoss" or "Manager" or "Worker" [11] private double _basePay; // Hourly or weekly pay [12] public Person(String name, String title, double basePay) { [13] . name = name; _title = title; _basePay = basePay; [14] } [15] public double ycomp() { [16] if (_title.equals("BigBoss")) { [17] return _basePay*52 + 5000000; [18] } else if (_title.equals("Manager")) { [19] return _basePay*52; [20] } else if (_title.equals("Worker")) { [21] return _basePay*52*40; [22] } else { [23] throw new IllegalArgumentException(); [24] } 1. IllegalArgument Exception 2. NullPointer Exception 3. try Unit u = new Person("jo",null, 3200); AssertTrue(false); } catch (IllegalArgumentException a) 0 4. Unit u = new Person("jo",null,3200); tryl u.ycompo: AssertTrue(false); catch (IllegalArgumentException a) O 5. Best precondition for ycomp) try Unit u = new Person("jo","woker",3200); AssertTrue(false); catch (IllegalArgumentException a) 0 Exceptions may occur during an execution of ycomp. 6. II DIO Test that ycomp does not throw an illegalArgument Exception. Unit u = new Person("jo","woker", 3200); tryl u.ycompo; AssertTrue(false); Test that constructor rejects invalid titles with misspelled job titles catch (IllegalArgumentException a) O 7. IllegalArgument and NullPointer Exceptions Test that constructor rejects invalid titles with null fields 8. tryl Unit u = new Person("jo", null, 3200); catch (IllegalArgumentException a) { AssertTrue(false); 9. assert(_title.equals("BigBoss") || _title.equals("Manager") || _name.equals("Worker")); 10. assert(_title != null); 11. assert(l_title!=null) && (_title.equals("BigBoss") || _title.equals("Manager") || title.equals("Worker")); 12. assert((_title.equals("BigBoss") II _title.equals("Manager") || _title.equals("Worker")) &&_titlee != null))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!