4 3L. Test-Driven Development
4.1 Watch
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
- Implement
getSize()
Method- The size is the number of tickets currently present in the wallet.
- Implement
getLength()
Method- The length is the capacity of the wallet - the maximum number of tickets our wallet can hold.
- 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 calledremove
. It should take no parameters and it should return the most recently addedConcertTicket
.
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: }
- There is no method for removing a
- 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:
Which opens this tab:
- Running Tests
If there are no errors, go to
WalletTest.java
in thetest/ConcertTicket
folder. Click on the thick double green arrow on line 7 to run all tests -
- 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
4.6 Opening Project in Visual Studio Code
Download the project files from
Unzip the files to preferably an
ITSC 2214
folder for this class. You must have created this folder before for previous labs.Launch Visual Studio Code. Go to File > Open Folder…, navigate and select the folder where you have extracted the zip file.
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:
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.
Run the command:
umm grade ./script.rhai
4.9 Submitting your Project
When you are ready to submit your assignment:
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.
You can copy and run the
umm create-submission
command in the terminal, and that should create a zip file with a name similar tosubmission-2024-01-24-15-04-50.zip
.umm create-submission
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.