1. Open Your project

First, open the project we worked on last week in your preferred editor. This tutorial uses VS Code.

image.png

image.png

2. Declare Variables for the Rest of Our Armor

Now that our helmet works, we’re going to do the same steps for the rest of our armor.

image.png

3. Initialize variables for the Rest of Our Armor

Now that we have each of our variables, we need to initialize them.

image.png

4. Change Constructor to Pass an Argument

What is an argument?

No, it’s not what happens when you and your friend fight over which video game is better.

(And for the record, it’s Halo, Geraint!)

In programming, an argument is a value—basically a piece of information—that we give to a function or, in our case, a constructor.

When the function or constructor is called, it uses that information so it can run with the specific input we want.

Think of an argument as the details you hand over so the code knows exactly what to do.