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

starter code for week 13 lab

parent cc97c184
No related branches found
No related tags found
No related merge requests found
# Mac file finder metadata
.DS_Store
# Windows file metadata
._*
# Thumbnail image caches
Thumbs.db
ethumbs.db
# MS Office temporary file
~*
# Emacs backup file
*~
# Common
[Bb]in/
[Bb]uild/
[Oo]bj/
[Oo]ut/
[Tt]mp/
[Xx]86/
[Ii][Aa]32/
[Xx]64/
[Xx]86_64/
[Xx]86-64/
[Aa]rm
[Aa]32
[Tt]32
[Aa]64
*.tmp
*.bak
*.bk
*.swp
# Java files
*.class
javadoc/
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# JetBrains (IntelliJ IDEA, PyCharm, etc) files
.idea/
cmake-build-*/
*.iml
*.iws
*.ipr
# Eclipse files
.settings/
.project
.classpath
.buildpath
.loadpath
.factorypath
local.properties
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.unl.cse.soft160.project_plan</groupId>
<artifactId>project_plan</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>project_plan</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
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();
}
}
package edu.unl.cse.soft160.project_plan;
import java.util.HashSet;
import java.util.Set;
public class Project {
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 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 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 void addPredecessor(Task other) {
// TODO: replace stub
}
public TaskStatus getStatus() {
// TODO: replace stub
return TaskStatus.BLOCKED;
}
public void complete() {
// TODO: replace stub
}
public String toString() {
// TODO: replace stub
return "〈Placeholder〉";
}
}
package edu.unl.cse.soft160.project_plan;
public enum TaskStatus {
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;
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 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;
}
}
package edu.unl.cse.soft160.project_plan;
public enum TeamMemberRole {
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