EECS 183 Labs

EECS 183 Lab 4: RPS Functions + Testing

Lab due on your scheduled lab day (September 22 - 25)

Lab accepted for full credit until Monday, September 28 11:59 pm Eastern

You must complete both part 1 and part 2 to receive full credit for the lab.

In this lab, you will implement and test two Project 2 functions. The main focus of the lab exercise is how to write and test function behavior before full Project 2 integration.

By completing this lab assignment, you will learn:

For all labs in EECS 183, to receive a grade, every student must individually submit the lab assignment, even if you are working in a group.

Starter Files

You can download the starter files using this link.

The IDE setup tutorials for Visual Studio and XCode include a video about how to set up a project using the starter files. You can access the tutorials here:

Lab Assignment Part 1 - start.cpp, test.cpp, rpsLab.cpp

NOTE: The test cases you create in this lab can and should be used for your Project 2 tests. Specifically, add those tests to your test.cpp in Project 2. The implementations you write in this lab for isMoveGood() and announceRoundWinner() should also be copied into your rps.cpp in Project 2.

File Roles

Function to implement: isMoveGood()

/**
 * Requires: nothing
 * Modifies: nothing
 * Effects:  Returns true if and only if move represents a valid move character:
 *           one of 'R', 'r', 'P', 'p', 'S', 's'. Returns false otherwise.
 */
bool isMoveGood(char move);

Function to implement: announceRoundWinner()

/**
 * Requires: winnerName is the name of the player who won the round.
 * Modifies: cout
 * Effects:  If winnerName is empty, print a message indicating the round
 *           is a draw. Otherwise, print a congratulatory message to the
 *           winner.
 * Prompt:   This round is a draw!
 *           ------------- OR -------------
 *           [winner_name] wins the round!
 */
void announceRoundWinner(string winnerName);

Required tests in test.cpp

Implement and call both:

IMPORTANT: Since announceRoundWinner() has return type void, you must test it by checking printed output behavior.

Bugs To Expose

There are a total of 4 unique bugs to find in buggy implementations of these functions. Your tests should expose the bugs from the following set:

How to Submit

Note: If you’re using Xcode and need to find files on disk, right-click the file in the Navigator and choose Show in Finder.

If you’re using Visual Studio and need to find files on disk, right-click the file tab and choose Open Containing Folder.

IMPORTANT: For all labs in EECS 183, to receive a grade, every student must individually submit the lab. Late submissions for labs will not be accepted for credit.

Lab Assignment Part 2 - RME Canvas Quiz

RMEs

RMEs (Requires, Modifies, Effects) are the comments that appear above function declarations for labs and projects. They document what a programmer needs to know to be able to call a function.

To complete this portion of the lab:

  1. Take a few minutes to review the slides on RMEs here.
  2. Complete the Canvas quiz Lab 4 - RME Quiz..