Be sure to review the techniques for creating and invoking the toString method, as well as the equals method and copy constructor.
Problem #1 (10 points)
For this question, you may simply modify the Dog class you created in assignment #4. For your convenience, I am copying the requirements here:
Have fields for: name (String), type of species (String), and age (int). Choose identifiers wisely. Create all the usual methods that are required for user-defined classes. At this point, of course, the visibility of your 3 fields must all be private. Have a default constructor, and a constructor that allows you to initialize all 3 of the fields.
However, instead if a printInfo method, you must now create a toString method. Be sure to do review the proper format of this method as was discussed last week. (In fact, from this point forward, you will no longer have printInfo methods. Instead, you will always have a toString method). Also include an equals method and a copy constructor. Your grade on this problem will depend on proper implementation of these three methods!
Problem #2 (15 points)
Create a GUI with text fields for name, species, and age. Have a button that says ‘Create Object’. When the user clicks the button, your GUI should retrieve the information from the fields and instantiate a Dog object. Then take that object and simply output it to the console. Remember that you must have a properly implemented toString method in order to do this.
Bonus 4 points: Create an additional textbox in your GUI and output the object to the GUI instead of to the console.
Problem #3 (15 points)
Create a GUI that has one text field for the user to enter a number in U.S. Dollars. Then have two buttons: One button should say ‘Convert to Pesos’ and the other should say ‘Convert to Euros’. Depending on which button the user clicks, do the conversion, and output the result to a different textfield. For pesos, use $1 U.S. Dollar = 12.31 Mexican Pesos. For euros: $1 U.S. = 0.78 Euros.
As usual, ZIP all of your source code files and submit to D2L.