Question: Let's consider the following java classes. class Person { public String name=name :; public Persono { System.out.println( Person Created ); 1 public Person (String s)

Let's consider the following java classes. class Person \{ public String name="name :"; public Persono \{ System.out.println(" Person Created "); 1 public Person (String s) name=s; public String toString0 return " The name is " + name ; 1 class Employee extends Person I private int salary =99; // salary should be a positive integer; public int getSalaryo return salary; public void setSalary(int s) salary =s; I public void addPromotion(int s) { salary +=s;} public boolean donate(int s) salary - s; return True; Q3.1 Complete the following table while executing the main method step by sted (onlv dash lines) I/The salary of the employee is set to n if it is positive. Orherwise the salary is set to the by default value. If else Q4.2 Overrides the method toString() in the class Employee. The name and the salary of the employee should be returned public String toString 0 return super. Q4.3 Overload the method donate (....) in the class Employee. The method contains two parameters : the amount 5 and the name of the charity association. The donation is possible only if the salary is >1000. In this case, "True" is returned by the method. If the salary is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
