# Vault
A vault stands in the way of your progress. We need a secret agent to find the code to get through.
You have been given a Vault class that describes how the vault will work. It has a secret code that will be randomly chosen each time the program is run. It also contains a tryCode() method that takes a number as a parameter and returns true if that number opens the vault, false otherwise.
Create a Runner class with a main method. Create a vault object and call the tryCode() method. Print out the answer to see if you successfully opened the vault.
Make a SecretAgent class that has a method findCode() that takes a Vault as a parameter. The codes are between 0 and 1 million. This method will try all the codes, and return the first code that opens the vault, or -1 if no code opened the vault.
Add the SecretAgent object to main. Use a syso to print the result from findCode()
← 05 Popcorn 07 Duck →