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

Added starter code for Homework 6

parent 3123b103
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
# Robot Requirements
1. If the driver presses the "Up" arrow, then the cart shall increase its speed by 1,000 furlongs per fortnight.
2. If the driver presses the "Down" arrow, then the cart shall decrease its speed by 1,000 furlongs per fortnight.
3. The cart shall not travel faster than 15,000 furlongs per fortnight on smooth terrain, 10,000 furlongs per fortnight on moderate terrain, and 5,000 furlongs per fortnight on rough terrain.
4. If the driver presses the "Right" or "Left" arrow, then the cart's wheels shall deflect 5° right or left, as appropriate.
5. The cart shall not deflect its wheels more than 30° away from "forward" in either direction.
6. If the driver presses the "Emergency Stop" button, then the cart shall perform an emergency stop.
7. If the cart is traveling faster than its maximum speed, then it shall decrease its speed by 1,000 furlongs per fortnight.
8. If the short-range radar detects that the cart is overtaking a moving object, then the cart shall decrease its speed by 1,000 furlongs per fortnight.
9. If the short-range radar detects a stationary object in the cart's path, then the cart shall perform an emergency stop.
10. If the short-range radar detects an object in the cart's path that is approaching the cart, then the cart's wheels shall deflect 5° to avoid a collision.
11. If no other action is required, then the cart shall display its current speed and heading.
12. If the cart's wheels are turned too far away from "forward", then it the cart's wheels shall deflect in the direction necessary to return to tolerances.
13. An emergency stop, whether commanded by the driver or directed by the cart's safety logic, shall override all other possible actions *except* turning to avoid a collision.
14. If the cart cannot perform a required action, it shall display a message explaining why.
15. If the cart's previous action was an emergency stop, and if the cart has not stopped, then the cart shall display a message explaining why.
\ No newline at end of file
<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.tdd_homework</groupId>
<artifactId>tdd_homework</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>tdd_homework</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</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.tdd_homework;
public class Cart {
public enum DriverInput {
NO_INPUT, UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, EMERGENCY_STOP,
}
public enum Terrain {
SMOOTH, MODERATE, ROUGH,
}
public enum Action {
ACCELERATE, DECELERATE, DEFLECT_WHEELS_LEFT, DEFLECT_WHEELS_RIGHT,
EMERGENCY_STOP, DISPLAY_SPEED_AND_HEADING, DISPLAY_MESSAGE,
}
public static Action act(DriverInput input, int currentSpeed, int currentWheelDeflection,
Terrain terrain, int rateOfApproach, Action lastActionTaken) {
return Action.DISPLAY_SPEED_AND_HEADING;
}
}
package edu.unl.cse.soft160.tdd_homework;
import static org.junit.Assert.*;
import org.junit.Test;
public class CartTest {
@Test
public void testAct() {
fail("Not yet implemented");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment