-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduleVariance.java
More file actions
69 lines (53 loc) · 2.73 KB
/
ScheduleVariance.java
File metadata and controls
69 lines (53 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package Git.MiniProject;
public class ScheduleVariance extends Finance {
private float scheduleVariance;
private double daysPassed;
private double projectDuration;
public static final String BLUE_BACKGROUND_BRIGHT = "\033[0;104m";// BLUE
public static final String ANSI_GREEN_BACKGROUND = "\u001B[42m"; //"\033[42m" Green
public static final String ANSI_YELLOW_BACKGROUND = "\u001B[43m"; // Yellow
public static final String ANSI_RED_BACKGROUND = "\u001B[41m"; // Red
public static final String CYAN_BRIGHT = "\033[0;96m"; // CYAN
public static final String ANSI_GREEN = "\u001B[32m";
public static final String WHITE_UNDERLINED = "\033[4;37m"; // WHITE
// Bold
public static final String BLACK_BOLD = "\033[1;30m"; // BLACK
// Reset
public static final String RESET = "\033[0m"; // Text Reset
public ScheduleVariance(double budget, double earnedValue, double projectDuration, double daysPassed, String projectId) {
super(budget, earnedValue, projectDuration, daysPassed, projectId);
this.daysPassed = daysPassed;
this.projectDuration = projectDuration;
}
public float getScheduleVariance() {
this.scheduleVariance = (float) ((getEarnedValue()) - (this.getPlannedValue()));
if (scheduleVariance<0){
System.out.println(ANSI_RED_BACKGROUND+BLACK_BOLD+"Project ID: " + getProjectId());
}else if(scheduleVariance>0){
System.out.println(ANSI_GREEN_BACKGROUND+BLACK_BOLD+"Project ID: " + getProjectId());
}else if(scheduleVariance==0) {
System.out.println(BLUE_BACKGROUND_BRIGHT + BLACK_BOLD + "Project ID: " + getProjectId());
}
return scheduleVariance;
}
public double getPlannedValue() {
double plannedValue;
plannedValue = getBudget() * getPlannedPercentageCompleted();
return plannedValue;
}
public double getPlannedPercentageCompleted() {
double plannedPercentageCompleted;
plannedPercentageCompleted = (daysPassed / projectDuration);
return plannedPercentageCompleted;
}
public String toString() {
String costString;
costString ="======SCHEDUAL VARIANCE======="+System.lineSeparator();
costString+="______________________________"+System.lineSeparator();
costString+=" "+getScheduleVariance()+"SEK"+System.lineSeparator();
costString+="______________________________"+System.lineSeparator();
costString+=""+System.lineSeparator();
costString+=BLACK_BOLD+"RED BACKGROUND = BEHIND, GREEN BACKGROUND = ON TRACK"+System.lineSeparator();
return costString;
}
}