This lab is due by Friday, November 08, 2019, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.
Concepts
Focus on expanding the Godzilla class from Lab7C.
Suggestion: Use NotePad or WordPad
Consider using NotePad or WordPad on your computer to write your code for this lab. Once you feel good about what you've written, then copy the code into your project. Doing this will help you see where you might make mistakes on the exam!
You should write a
main.cpp
that tests each feature of your class works as expected. You
will need to submit your class declaration file, your class
definition file, and your
main.cpp
file for this lab.
Expanded Godzilla
Class
We are now going to properly structure our Class members correctly. Begin by denoting your data members as private
and the methods as public
. Add the following functions below to your class you should include in your class:
- Appropriate getter and setter functions. The power setter should ensure that the power is greater than zero. If not, then reassign it to the random default value.
- Use a private helper function wherever one makes sense to refactor your constructors and setters.
Now in main, prompt the user to enter the power & health for the godzilla
object (not the mechagodzilla
object). Create
godzilla
with the default constructor and then call the corresponding setters to assign the new user entered values. When
you output the data members' values to verify, use the corresponding getters.
Lab Submission
You will submit your solution to this lab with the rest of Set7. Detailed instructions for doing this are posted in Assignment 7.
This lab is due by Friday, November 08, 2019, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.