Instructions:

Write a Gun class for Soldier.java. The files are in HandsonC.zip as a BlueJ package. The Gun class is a class for guns that a soldier possesses. When creating a gun, you indicate the name of that gun as well as its bullet capacity (e.g., a fully-loaded pistol has 6 bullets, and a machine gun has 30). This capacity is important because this is what the gun will contain after the load() method is called. Upon object creation, the gun has zero bullets (or rounds) in it. There are two ways to fire a gun: either you specify the number of rounds that you fire or you don't. If you don't, it is assumed that only one round will be fired. Arrange it so that firing will not work (no shots are fired) if there aren't enough rounds. The Gun class also needs to keep track of the total shots fired.

Begin by writing a stubbed class for Gun (add empty methods in the Gun class just to make Soldier.java compile); this is worth 40 points of your hands-on grade. Then, implement the methods in Gun.java. Do not revise Soldier.java.

When you invoke the execute() method in Soldier, this output should appear.

Submit the Gun.java program through the course submission website by 12:20pm.