4  3L. Test-Driven Development

4.1 Watch

  1. How to check for compiler errors is VSCode

  2. Installing and Using Codeium

4.2 Project Overview

Here are the files in your project for the ConcertTicket package:

.
├── src/
│   └── ConcertTicket/
│       ├── ConcertTicket.java
│       └── Wallet.java
└── test/
    └── ConcertTicket/
        └── WalletTest.java

Using the files tab on the left, double-click on the ConcertTicket.ConcertTicket class and the ConcertTicket.Wallet class. Get familiar with these files and read through the comments!

4.3 Detailed Instructions

  1. Implement getSize() Method
    • The size is the number of tickets currently present in the wallet.
  2. Implement getLength() Method
    • The length is the capacity of the wallet - the maximum number of tickets our wallet can hold.
  3. Implement remove Method
    • There is no method for removing a ConcertTicket from the wallet! Your job is to write that method. The method should be called remove. It should take no parameters and it should return the most recently added ConcertTicket.
    public ConcertTicket remove() {
        // Create a ConcertTicket reference variable (DO NOT create a
        // new ConcertTicket - JUST create the reference variable)
    
        // Use the size variable (which always points at the next empty
        // slot) to get the last added ConcertTicket from the array:
    
        // Set that array slot to null:
    
        // Decrement the size variable:
    
        // Return the Concert Ticket:
    }
  4. Checking for Errors
    • Once you are done, make sure there are no syntax errors. You can do so by opening the problems view by clicking on this button in the bottom left:

      Problems View Button
    • Which opens this tab:

      Problems View Tab
  5. Running Tests
    • If there are no errors, go to WalletTest.java in the test/ConcertTicket folder. Click on the thick double green arrow on line 7 to run all tests -

      Double green arrow
  6. Submitting
    • If all tests have passed, hit submit!

4.4 Rubric

  • Project must compile to receive a grade.
  • All tests for ConcertTicket.WalletTest must pass (25 points).

4.5 Project Files

Download the project files here.

4.6 Opening Project in Visual Studio Code

  1. Download the project files from

  2. Unzip the files to preferably an ITSC 2214 folder for this class. You must have created this folder before for previous labs. Unzip_Location_ITSC_2214

  3. Launch Visual Studio Code. Go to File > Open Folder…, navigate and select the folder where you have extracted the zip file. Vs_code_extract_zip

4.7 Update the autograder

First, please update your autograder by running:

umm update

4.8 Checking Autograder Feedback

You can check your grade locally by following these steps:

  1. Open a terminal. To open a terminal in Visual Studio Code on different operating systems:

    • Windows: Press ” Ctrl + ` ” or ” Ctrl + Shift + ` ” to open the integrated terminal.

    • Mac: Press ” Cmd + ` ” or ” Cmd + Shift + ` ” to open the integrated terminal.

  2. Run the command:

    umm grade ./script.rhai

4.9 Submitting your Project

When you are ready to submit your assignment:

  1. Open a terminal. To open a terminal in Visual Studio Code on different operating systems:

    • Windows: Press ” Ctrl + ` ” or ” Ctrl + Shift + ` ” to open the integrated terminal.

    • Mac: Press ” Cmd + ` ” or ” Cmd + Shift + ` ” to open the integrated terminal.

  2. You can copy and run the umm create-submission command in the terminal, and that should create a zip file with a name similar to submission-2024-01-24-15-04-50.zip.

    umm create-submission
  3. Submit the submission-2024-... .zip file to Gradescope. The submission zip file will appear in the file explorer tab of VS Code. You can right click on this file and click on reveal in explorer (windows) or reveal in finder (mac) in order to find this file. then, you can drag and drop this to gradescope for submission.