Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago