I am starting to work on a project to calculate the average time a project takes until its completion. It takes a function f(x), which the user will provide, to determine a single task's completion time. Furthermore, users will be prompted to input how many tasks are needed to complete x project, the names/descriptions of each task, and the predecessors for each task (for instance, if building a house, you must finish the floor before beginning with walls, so if the floor - referred to as task #1- was done in 7 days, and the user inputs that task "walls" have predecessor "task # 1" then task "Walls" must initiate on the day "task # 1" was finished. In other words, if a task has predecessors, then it should start on the latest end date of all its predecessors.
For the function f(x), a random number will be generated for (x), and the program should run, for example, 100 times, store the estimated days to complete the project, and then average all estimated days.
What would be the best way to determine the starting date for a task based on its predecessors?
Any recommendations to make the program more efficient?
I am currently trying to solve this problem in java, by creating a class Activity, which has local variables to store all necessary information for a task, as well as setters and getters to store and retrieve said information.
As of now, I'm storing all tasks on an Activity array and then looping through the array to find out a starting and ending day based on its predecessors.
Am I on the right track?