Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Employee and Intern Classes Create an Employee class to represent an employee of a company. The class should have name, email, age, salary properties and

Employee and Intern Classes
Create an Employee class to represent an employee of a company. The class should have name, email, age, salary properties and appropriate getters and setters.
Create an Intern class that extends from Employee. The Intern class should have a salary limit of 20000(constant).
Implement validation in the Intern class to ensure that an intern is not created (or salary updated) with a salary that exceeds the maximum allowed value.
Write a program that creates 10 Employee objects and prints all of their properties (name, email, age, salary) to a file named employees.txt.
Tips
Be sure to consider the relationship between the Employee and Intern classes when designing your solution.
Think about the different properties and behaviors that are applicable to both Employee and Intern objects and consider how you can use inheritance to avoid duplication of code.
Use appropriate access modifiers (e.g. private, protected, public) to control the visibility of your class properties and methods.
Make sure to handle edge cases and handle them appropriately (e.g. what happens if an Intern object is created with a salary that exceeds the maximum allowed value?).

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

Students also viewed these Databases questions

Question

=+(2,5], P1) such that Fc F, and P, agrees with P on $ .

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago