Question: Given the following class definition: public class Weapon { private String type; private double speed; } Provide the following: 1) A constructor to initialize

Given the following class definition: public class Weapon { private String type; private double speed; } Provide the following: 1) A constructor to initialize the two fields 2) A toString method that returns in the format: "Weapon: Stick, 5.2" 3) Call the two methods that you create above in a main method 4) In the main method, create an Arraylist of Weapon objects and store a weapon object. Print this object using the index. (Not all the elements, just the element at index O)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
