In this semester, during your tutorials, you will be developing an application managing the employees working in a computer software company.
In the subsequent tutorial exercises, every week, we will be adding new features and requirements to this application. Therefore, you need to keep a copy of your weekly solutions for future enhancement and extension.
By the end of this semester, you should have a complete application for the company, which covers most (if not all) of the theories and concepts you have learned in this unit. Please keep in mind that we will only mark your solutions for Week 2, Week 4, Week 6 and Week 9 exercises.
Description of the Company
Every employee of the company has a name and a unique 4-digit id. Each employee works a fixed number of hours per week and is paid according to a salary rate (the dollar amount earned per hour).
The company has many programming teams working on different projects. Each team has a name, and consists of a team leader and exactly six programmers. All the team members (programmers and team leader) are employees of the company.
Tutorial Tasks
- Write a Java program consisting of the following 3 classes to represent objects in the company:
Employee (4 marks)
Team (4 marks)
Company (2 marks) - The Employee class should have three attributes: name, id and a salary rate.
- The Team class should have three attributes: name, team leader and programmers.
- In the Employee class and Team class, you should also provide:
- a constructor with default values,
- at least one constructor with parameters,
- corresponding accessor and mutator methods for ALL attributes; and
- a toString method, which returns a string of object’s details
- The Employee class should also have a method called calculateSalary. The method takes an integer as a parameter which represents the number of hours worked. It calculates the salary of the employee using the formula: salary rate x number of hours.
- The Company class serves as the driver class. Create a number of Employee objects and Team objects in this class (as many as you wish) and print their details on the screen. A sample output for one team is shown below – after the command “java Company” is entered at the command prompt
No comments:
Post a Comment