CSCI 261 - Programming Concepts - Fall 2020

Lab 7C - Classes Part I: Godzilla

This lab is due by Thursday, November 19, 2020, 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 defining a Godzilla class from scratch.


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.


Godzilla Class


We are going to declare a class called Godzilla that will allow us to ultimately simulate a battle between Godzilla & Mechagodzilla. Create a new class called Godzilla that contains private data members for storing the name (as a string), the health and power (as doubles) of a Godzilla creature. Public functions you should include in your class:

Now in main, create two Godzilla objects - one named godzilla and the other named mechagodzilla. godzilla should be created using the default constructor. Then prompt the user to enter the power & health for the godzilla object and call the corresponding setters to assign the new user entered values. Prompt the user to provide the health and power of mechagodzilla before making the object so the parameterized constructor can be used.

To verify your objects are correct, output the name, health, & power of godzilla and mechagodzilla. When you output the data members' values to verify, use the corresponding getters.

An example output is below:

Enter the health of Godzilla: 80
Enter the power of Godzilla: 20

Enter the name of the second creature: Metalzilla
Enter the health of the second creature: 95
Enter the power of the second creature: 30

The two creatures are:
Godzilla (P: 20) - H: 80
Metalzilla (P: 30) - H: 95

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 Thursday, November 19, 2020, 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.