I have already implement the Department, Employee, Project and WorksOn classes.
Here is the Department class:
import java.util.*;
public class Department {
private int dNumber;
private String dName;
private int manager; // Private data members
private double budget;
private String startDate;
public Department(int dNumber, String dName, int manager, double budget, String startDate)
{ // Parameterized Constructor for Department
this.dNumber = dNumber;
this.dName = dName;
this.manager = manager;
this.budget = budget;
this.startDate = startDate;
}
@Override
public String toString() { // toString method for returning values
return String.format("%d, %s, %d, %.2f, %s", dNumber, dName, manager, budget,
startDate);
}
}
Here is the Employee class:
import java.util.*;
public class Employee {
private int eNumber;
private String eName;
private String dob;
private String address; // Private data members
private String gender;
private double salary;
private int supervisor;
private int dNumber;
public Employee(int eNumber, String eName, String dob, String address, String gender,
double salary, int supervisor, int dNumber) { // Parameterized Constructor for Employee
this.eNumber = eNumber;
this.eName = eName;
this.dob = dob;
this.address = address;
this.gender = gender;
this.salary = salary;
this.supervisor = supervisor;
this.dNumber = dNumber;
}
public int dNumber() { // public method getNumber() for returning Employee Number
return dNumber;
}
@Override
public String toString() {// toString method for returning values
return String.format("%d, %s, %s, %s, %s, %.2f, %d, %d", eNumber, eName, dob,
address, gender, salary, supervisor, dNumber);
}
}
Here is the Project class:
import java.util.*;
public class Project {
private long pNumber;
private String title;
private String sponsor; // Private data members
private int dNumber;
private double budget;
public Project(long pNumber, String title, String sponsor, int dNumber, double budget) { //
Parametzied Constructor for Project
this.pNumber = pNumber;
this.title = title;
this.sponsor = sponsor;
this.dNumber = dNumber;
this. budget = budget;
}
public long getNumber() { // public method getNumber() for returning Project Number
return pNumber;
}
public String toString() { // toString method for returning values
return String.format("%d, %s, %s, %d, %.2f", pNumber, title, sponsor, dNumber, budget);
}
}
Lastly, heres the WorksOn class:
import java.util.*;
public class WorksOn {
private Project proj;
private Employee emp; // Private data members
private int hours;
public WorksOn(Project proj, Employee emp, int hours) { // Parameterized Constructor for
WorksOn
this.proj = proj;
this.emp = emp;
this.hours = hours;
}
@Override
public String toString() { // toString method for returning values
return String.format("%s, %s, %d", proj, emp, hours);
}
}
I need help with the DEP class for java. Below are the instructions:
Define a class DEP in a source file DEP.java that contains private data members:
depts: A container that c.
APM Welcome, APM North West Network Conference, Synergies Across Sectors
I have already implement the Department, Employee, Project and Wor.pdf
1. I have already implement the Department, Employee, Project and WorksOn classes.
Here is the Department class:
import java.util.*;
public class Department {
private int dNumber;
private String dName;
private int manager; // Private data members
private double budget;
private String startDate;
public Department(int dNumber, String dName, int manager, double budget, String startDate)
{ // Parameterized Constructor for Department
this.dNumber = dNumber;
this.dName = dName;
this.manager = manager;
this.budget = budget;
this.startDate = startDate;
}
@Override
public String toString() { // toString method for returning values
return String.format("%d, %s, %d, %.2f, %s", dNumber, dName, manager, budget,
startDate);
}
}
Here is the Employee class:
import java.util.*;
public class Employee {
private int eNumber;
2. private String eName;
private String dob;
private String address; // Private data members
private String gender;
private double salary;
private int supervisor;
private int dNumber;
public Employee(int eNumber, String eName, String dob, String address, String gender,
double salary, int supervisor, int dNumber) { // Parameterized Constructor for Employee
this.eNumber = eNumber;
this.eName = eName;
this.dob = dob;
this.address = address;
this.gender = gender;
this.salary = salary;
this.supervisor = supervisor;
this.dNumber = dNumber;
}
public int dNumber() { // public method getNumber() for returning Employee Number
return dNumber;
}
@Override
public String toString() {// toString method for returning values
return String.format("%d, %s, %s, %s, %s, %.2f, %d, %d", eNumber, eName, dob,
address, gender, salary, supervisor, dNumber);
}
}
Here is the Project class:
import java.util.*;
public class Project {
private long pNumber;
private String title;
private String sponsor; // Private data members
3. private int dNumber;
private double budget;
public Project(long pNumber, String title, String sponsor, int dNumber, double budget) { //
Parametzied Constructor for Project
this.pNumber = pNumber;
this.title = title;
this.sponsor = sponsor;
this.dNumber = dNumber;
this. budget = budget;
}
public long getNumber() { // public method getNumber() for returning Project Number
return pNumber;
}
public String toString() { // toString method for returning values
return String.format("%d, %s, %s, %d, %.2f", pNumber, title, sponsor, dNumber, budget);
}
}
Lastly, heres the WorksOn class:
import java.util.*;
public class WorksOn {
private Project proj;
private Employee emp; // Private data members
private int hours;
public WorksOn(Project proj, Employee emp, int hours) { // Parameterized Constructor for
WorksOn
this.proj = proj;
this.emp = emp;
this.hours = hours;
}
4. @Override
public String toString() { // toString method for returning values
return String.format("%s, %s, %d", proj, emp, hours);
}
}
I need help with the DEP class for java. Below are the instructions:
Define a class DEP in a source file DEP.java that contains private data members:
depts: A container that can store departments. It is an ArrayList of Department type.
emps: A container that can store employees. It is an ArrayList of Employee type.
projs: A container that can store projects. It is an ArrayList of Project type.
works: A container that can store objects of works on. It is an ArrayList of WorksOn type.
Implement Java methods in the file DEP.java that include:
Default constructor that initialise values to all data members.
Use the departments information provided below to add the objects of departments to the correct
container.
Use the employees information provided below to add the objects of employees to the correct
container.
Use the projects information provided below to add the objects of projects to the correct
container.
Display a menu that includes items below.
1. Display all departments.
2. Display all employees.
3. Display all projects.
4. Display information for employees who works on projects.
5. Add a record for an employee who works on a project.
0. Exit.
The Java program gets an input number of the menu and processes the required method for that
item until 0 is input.
When item 1 is selected, the method displays all the department information.
5. When item 2 is selected, the method displays all the employee information.
When item 3 is selected, the method displays all project information.
When item 4 is selected, the method displays all information for employees who works on
projects.
When item 5 is selected, the method gets inputs of employee number, project number and total
hours that the employee works on the project. The method verifies input information: o If the
employee exists, then save it to an employee object variable. o If the project exists, then save it
to a project object variable. o If the employee has not been allocated to the project, input the total
working hours. Save the works on information to the correct container. o Otherwise, the method
returns to the caller.
Testing data
The data of departments, employees and projects are given below.
Department: 1, "SALES", 110, 1234.00, "02/01/2012"
Employee: 600, "Willy", "01/01/1988", "41 Station Street, Wollongong, NSW 2500", "M",
250.5, 0, 9
Project: 1001, "Computation", "Microsoft", 8, 25000
Please include ALL code