THINK FIRST·CODE LATER

← All labs

Three-point (PERT) project estimate

Problem

Estimate a sequence of independent tasks with three-point estimation.

Input: lines task O M P until the end of input (O ≤ M ≤ P, real numbers, days).

For each task print task: E=x.xx SD=x.xx with E = (O + 4M + P) / 6 and SD = (P − O) / 6. If a line violates O ≤ M ≤ P, print task: INVALID (need O <= M <= P) and ignore that task in the totals.

Then print:

Total E: x.xx days
Total SD: x.xx days
95% range: a.aa to b.bb days
Riskiest task: name (SD x.xx)

where Total SD = √(sum of SD²), the range is E − 2·SD to E + 2·SD (the lower bound is never below 0), and the riskiest task has the largest SD (first one on a tie). If there are no valid tasks, print only No valid tasks.

Input:

upload 2 3 10
wrapper 3 5 13
buddy 4 6 20

Output:

upload: E=4.00 SD=1.33
wrapper: E=6.00 SD=1.67
buddy: E=8.00 SD=2.67
Total E: 18.00 days
Total SD: 3.42 days
95% range: 11.17 to 24.83 days
Riskiest task: buddy (SD 2.67)

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

s5-2-data-1.txt

upload 2 3 10
wrapper 3 5 13
buddy 4 6 20
What your program must print for s5-2-data-1.txt
upload: E=4.00 SD=1.33
wrapper: E=6.00 SD=1.67
buddy: E=8.00 SD=2.67
Total E: 18.00 days
Total SD: 3.42 days
95% range: 11.17 to 24.83 days
Riskiest task: buddy (SD 2.67)

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < s5-2-data-1.txt

Windows PowerShell does not understand <:

Get-Content s5-2-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.