Skip to content
Snippets Groups Projects
Verified Commit 8f7d2b74 authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Reformatted for 2024 formatting convention

parent f0fb25e1
Branches main
No related tags found
No related merge requests found
package edu.unl.cse.soft160.project_plan;
public class Demo {
public static void main(String... arguments) {
Team alpha = new Team("Team Alpha");
alpha.addMember(TeamMemberRole.TEAM_LEAD, "Eve", "eve@example.com");
alpha.addMember(TeamMemberRole.CODING_LEAD, "Carol", "carol@example.com");
alpha.addMember(TeamMemberRole.UX_LEAD, "Bob", "bob@example.com");
alpha.addMember(TeamMemberRole.VERIFICATION_LEAD, "Alice", "alice@example.com");
for (String name : new String[] { "Alice", "Bob", "Carol", "Dan", "Eve" }) {
System.out.print("Email for " + name + ": ");
try {
System.out.println(alpha.getEmail(name));
} catch (IllegalArgumentException exception) {
System.out.println(exception.getMessage());
}
}
System.out.println();
Project bravo = new Project("Bravo", alpha);
Task gatherRequirements = new Task("Gather Requirements");
Task implementLogic = new Task("Implement Logic");
Task implementBackend = new Task("Implement Backend");
Task implementUI = new Task("Implement UI");
Task verify = new Task("Verify");
verify.addPredecessor(implementLogic);
verify.addPredecessor(implementBackend);
verify.addPredecessor(implementUI);
implementLogic.addPredecessor(gatherRequirements);
implementBackend.addPredecessor(gatherRequirements);
implementUI.addPredecessor(gatherRequirements);
bravo.addTask(gatherRequirements);
bravo.addTask(implementLogic);
bravo.addTask(implementBackend);
bravo.addTask(implementUI);
bravo.addTask(verify);
System.out.println(bravo);
System.out.println();
gatherRequirements.complete();
System.out.println(bravo);
System.out.println();
implementLogic.complete();
System.out.println(bravo);
System.out.println();
implementBackend.complete();
System.out.println(bravo);
System.out.println();
implementUI.complete();
System.out.println(bravo);
System.out.println();
verify.complete();
System.out.println(bravo);
System.out.println();
}
public static void main(String... arguments) {
Team alpha = new Team("Team Alpha");
alpha.addMember(TeamMemberRole.TEAM_LEAD, "Eve", "eve@example.com");
alpha.addMember(TeamMemberRole.CODING_LEAD, "Carol", "carol@example.com");
alpha.addMember(TeamMemberRole.UX_LEAD, "Bob", "bob@example.com");
alpha.addMember(TeamMemberRole.VERIFICATION_LEAD, "Alice", "alice@example.com");
for (String name : new String[] { "Alice", "Bob", "Carol", "Dan", "Eve" }) {
System.out.print("Email for " + name + ": ");
try {
System.out.println(alpha.getEmail(name));
} catch (IllegalArgumentException exception) {
System.out.println(exception.getMessage());
}
}
System.out.println();
Project bravo = new Project("Bravo", alpha);
Task gatherRequirements = new Task("Gather Requirements");
Task implementLogic = new Task("Implement Logic");
Task implementBackend = new Task("Implement Backend");
Task implementUI = new Task("Implement UI");
Task verify = new Task("Verify");
verify.addPredecessor(implementLogic);
verify.addPredecessor(implementBackend);
verify.addPredecessor(implementUI);
implementLogic.addPredecessor(gatherRequirements);
implementBackend.addPredecessor(gatherRequirements);
implementUI.addPredecessor(gatherRequirements);
bravo.addTask(gatherRequirements);
bravo.addTask(implementLogic);
bravo.addTask(implementBackend);
bravo.addTask(implementUI);
bravo.addTask(verify);
System.out.println(bravo);
System.out.println();
gatherRequirements.complete();
System.out.println(bravo);
System.out.println();
implementLogic.complete();
System.out.println(bravo);
System.out.println();
implementBackend.complete();
System.out.println(bravo);
System.out.println();
implementUI.complete();
System.out.println(bravo);
System.out.println();
verify.complete();
System.out.println(bravo);
System.out.println();
}
}
......@@ -4,38 +4,38 @@ import java.util.HashSet;
import java.util.Set;
public class Project {
private String name;
private Team team;
private Set<Task> tasks;
private String name;
private Team team;
private Set<Task> tasks;
public Project(String name, Team team) {
this.name = name;
this.team = team;
tasks = new HashSet<Task>();
}
public Project(String name, Team team) {
this.name = name;
this.team = team;
tasks = new HashSet<Task>();
}
public void addTask(Task task) {
tasks.add(task);
}
public void addTask(Task task) {
tasks.add(task);
}
public Set<Task> getTasks(TaskStatus status) {
Set<Task> result = new HashSet<Task>();
for (Task task : tasks) {
if (task.getStatus() == status) {
result.add(task);
}
}
return result;
}
public Set<Task> getTasks(TaskStatus status) {
Set<Task> result = new HashSet<Task>();
for (Task task : tasks) {
if (task.getStatus() == status) {
result.add(task);
}
}
return result;
}
public String toString() {
String result = "Project " + name + " (assigned to " + team + "):\n";
for (TaskStatus status : TaskStatus.values()) {
result += " " + status + ":\n";
for (Task task : getTasks(status)) {
result += " " + task + "\n";
}
}
return result + "End Project";
}
public String toString() {
String result = "Project " + name + " (assigned to " + team + "):\n";
for (TaskStatus status : TaskStatus.values()) {
result += " " + status + ":\n";
for (Task task : getTasks(status)) {
result += " " + task + "\n";
}
}
return result + "End Project";
}
}
package edu.unl.cse.soft160.project_plan;
public class Task {
public Task(String name) {
// TODO: replace stub
}
public Task(String name) {
// TODO: replace stub
}
public void addPredecessor(Task other) {
// TODO: replace stub
}
public void addPredecessor(Task other) {
// TODO: replace stub
}
public TaskStatus getStatus() {
// TODO: replace stub
return TaskStatus.BLOCKED;
}
public TaskStatus getStatus() {
// TODO: replace stub
return TaskStatus.BLOCKED;
}
public void complete() {
// TODO: replace stub
}
public void complete() {
// TODO: replace stub
}
public String toString() {
// TODO: replace stub
return "〈Placeholder〉";
}
public String toString() {
// TODO: replace stub
return "〈Placeholder〉";
}
}
package edu.unl.cse.soft160.project_plan;
public enum TaskStatus {
READY, BLOCKED, COMPLETED,
READY, BLOCKED, COMPLETED,
}
package edu.unl.cse.soft160.project_plan;
public class Team {
private String teamName;
private String teamLeadName;
private String teamLeadEmail;
private String codingLeadName;
private String codingLeadEmail;
private String UXLeadName;
private String UXLeadEmail;
private String verificationLeadName;
private String verificationLeadEmail;
private String teamName;
private String teamLeadName;
private String teamLeadEmail;
private String codingLeadName;
private String codingLeadEmail;
private String UXLeadName;
private String UXLeadEmail;
private String verificationLeadName;
private String verificationLeadEmail;
public Team(String teamName) {
this.teamName = teamName;
}
public Team(String teamName) {
this.teamName = teamName;
}
public void addMember(TeamMemberRole role, String name, String email) {
switch (role) {
case TEAM_LEAD:
teamLeadName = name;
teamLeadEmail = email;
break;
case CODING_LEAD:
codingLeadName = name;
codingLeadEmail = email;
break;
case UX_LEAD:
UXLeadName = name;
UXLeadEmail = email;
break;
case VERIFICATION_LEAD:
verificationLeadName = name;
verificationLeadEmail = email;
break;
}
}
public void addMember(TeamMemberRole role, String name, String email) {
switch (role) {
case TEAM_LEAD:
teamLeadName = name;
teamLeadEmail = email;
break;
case CODING_LEAD:
codingLeadName = name;
codingLeadEmail = email;
break;
case UX_LEAD:
UXLeadName = name;
UXLeadEmail = email;
break;
case VERIFICATION_LEAD:
verificationLeadName = name;
verificationLeadEmail = email;
break;
}
}
public String getEmail(String name) {
if (name.equals(teamLeadName)) {
return teamLeadEmail;
}
if (name.equals(codingLeadName)) {
return codingLeadEmail;
}
if (name.equals(UXLeadName)) {
return UXLeadEmail;
}
if (name.equals(verificationLeadName)) {
return verificationLeadEmail;
}
throw new IllegalArgumentException("Unable to find corresponding email address in \"" + this
+ "\" because no team member has the name \"" + name + "\".");
}
public String getEmail(String name) {
if (name.equals(teamLeadName)) {
return teamLeadEmail;
}
if (name.equals(codingLeadName)) {
return codingLeadEmail;
}
if (name.equals(UXLeadName)) {
return UXLeadEmail;
}
if (name.equals(verificationLeadName)) {
return verificationLeadEmail;
}
throw new IllegalArgumentException("Unable to find corresponding email address in \"" + this
+ "\" because no team member has the name \"" + name + "\".");
}
public String toString() {
return teamName;
}
public String toString() {
return teamName;
}
}
package edu.unl.cse.soft160.project_plan;
public enum TeamMemberRole {
TEAM_LEAD, CODING_LEAD, UX_LEAD, VERIFICATION_LEAD,
TEAM_LEAD, CODING_LEAD, UX_LEAD, VERIFICATION_LEAD,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment