Build a class Project with id(int) , desc (String), duration (int) , budget (double) and members (ArrayList of Workers). a. Provide a parameterized constructor Project (int id, String desc, double budget). The member array will be initialized as empty array and the initial duration of the project will be 0 b. Provide setters for description and budget and getters for all except members list. Provide a method getTotalCost() that calculates the total cost of the project by summing the budget and the salary of each member of the project. The salary of each m ember can be found by calculating an appropriate method of the Worker class.
public class Project {
int id;
String desc;
int duration;
double budget;
Arraylist<Worker> workers;
Project(int id, String desc, double budget) {
this.id = id;
this.desc = desc;
this.budget = budget;
}
}
Comments
Leave a comment