States And State Capitals Trivia

Overview

Today you'll be using Java Streams, Collections, and lambda functions to figure out some state trivia. Unlike your other labs, you won't be building anything today, or have to code any tests. All the tests are already set up for you! You just have to make them pass.

Setup

Look in the demo folder for a folder called statesAndCapitals. Open that project in IntelliJ. Open the StatesAndCapitals.java file and you'll see all the tests you have to implement. StatesAndCapitalsTest.java kicks off the tests, which live inside StatesAndCapitals.testStatesAndCapitals().

Feature Tasks

  • Get the unit tests up through the end of Advanced 2 working. (This means the Basic, Intermediate, Advanced 1, and Advanced 2 tests should all be working.) The results of your tests are printed at the end of testStatesAndCapitals() with "System.out.println(testResults);". "true" means a test is passing, while "false" means it is failing.
  • Alternately, submitting any 19 working tests is fine too.

Stretch Goals

  • Get the Advanced 3, Advanced 4, or (if you really like a challenge) the Expert tests working too.

Submission Instructions

  • Some rules:
    • No iteration or loops. Submission containing any of the following will result in 0 points for the assignment:
      • No for() or while() or do-while() loops.
      • Don't try to simulate a loop in other ways, like using if() and a counter variable.
      • Don't use the Java stream operations .forEach(), .forEachOrdered(), and peek(). (You can use them for debugging, but you can't submit them!)
      • Don't cheese answers by submitting them directly. If an answer is a one-word String, or a boolean, don't just submit the string or the boolean. If you do, you will not get credit for that test.
    • Don't make intermediate data structures. The solutions should all be "one-liners". Use only the variable provided.
  • Work in the StatesAndCapitals.java file to implement the unit tests.
  • Work on a non-master branch and make commits appropriately.
  • In your README file, include directions for how your grader can run your code and see outputs. (This should be very simple for this lab.)
  • Ensure that you can test your code by running ./gradlew run.
  • Create a pull request to your master branch with your work for this lab.
  • Submit the link to that pull request on Canvas. Add a comment with the amount of time you spent on this assignment.

Grading Rubric

  • 1 pt for finishing the Basic tests
  • 1 pt for finishing the Intermediate tests
  • 1 pt for finishing the Advanced 1 tests
  • 1 pt for finishing the Advanced 2 tests
  • 1 pt additional for finishing all tests Basic -> Advanced 2
  • 1 pt for README with clear instructions on how to run application

java-stream