Final Homework: File of Employees

COTI 3102 - Algorithms and Program Development II

Java is a high-level object-oriented programming language with portable, secure, and platform-independent desktop, web, mobile, and corporate development applications.


Problem

In package edu.uprb.company, place an enumerated type named Department with the following values:

2. In package edu.uprb.company place an class named Employee that holds the following data for a company employee:

This class must have the following methods:

3. Since a class diagram for the classes in package edu.uprb.company was not provided, you must generate one using the ObjectAid UML Explorer for Eclipse. Save this diagram as file EmployeeClassDiagram.jpg in your project.

4. In package edu.uprb.company place an application EmployeePayroll that reads a file of employees (employee.txt) and create another file that writes their data with the appropriate format, including their weekly salary.


Solution

  1. Enumeration (enum) typed named Department: Department.java
  2. Class named Employee: Employee.java
  3. Employee Class Diagram: EmployeeClassDiagram.jpg
  4. Application of Input/Output File EmployeePayroll: EmployeePayroll.java

Figure 1 - Employee Class Diagram

Figure 2 - Employee.txt with data

Figure 3 - Output of the program EmployeePayroll

Figure 4 - Payroll.txt with result data


Conclusion

Finally, Java's support for class, enumerations, and I/O files enhances the language's versatility and popularity in software development. Java classes promote code reuse and modular design by encapsulating data and behavior. Enumerations define constants, improving readability and reducing invalid values. Java's I/O file handling facilitates efficient file management, making it ideal for large data applications.