- Write an abstract
Employee
class withname
,type
, andpayment
attributes (and corresponding accessor functions). - Extend Employee with at least two child classes that represent types of employees (e.g.: salaried, hourly, contract, permanent, etc)
- Create an
EmployeeFactory
class with amakeEmployee
method that takes two Strings (employee name and employee type) and returns an Employee object constructed from the corresponding child class based on thetype
parameter.
- create an abstract Logger class with abstract methods
error
,warn
,info
,debug
(each method should take a single String argument — the message to be logged). - Extend Logger in at least two child classes (such as ConsoleLogger, EventLogger, ErrorLogger, or FileLogger) and implement the abstract methods.
- Create a LoggerFactory object with a createLogger method that returns a new Logger of the type requested.
- Request at least two different loggers in your main method and use them to log a few messages. (at different log levels if appropriate)
Note:
- ConsoleLogger should log messages to the console (prefixed by log level e.g.: “INFO: ”)
- FileLogger should log messages to a file. for this example a hardcoded
zipcode.log
file in the current directory is fine. - ErrorLogger should only log error level messages. calling its other logging methods should result in an error.