Answered step by step
Verified Expert Solution
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 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 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 eg private, protected, public to control the visibility of your class properties and methods.
Make sure to handle edge cases and handle them appropriately eg 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started