Due: Wednesday April 13, 2011, at noon, 100 points
For this assignment you will submit (in the usual way) multiple files. These files will contain a C++ program that you have named appropriately, each file with an appropriate name and appropriate extension. Be sure that your program compiles using the g++ compiler before you submit it.
Background: Dragons are important and are in a class of their own. A class of what I don't know, but you're going to code a class for dragons (or, dargons, if you prefer) so that Trogdor has a species home. There's nothing so depressing as existing without a species designation for yourself.
Specifications: You are to define a class called dragon. You will put the definition in a header file just for that class. You will also have an implementation file for the accompanying member functions for dragon. You will also provide a main function whose sole purpose in its meader little digital life is to be a "driver". A driver tests something else. In this case, your driver will declare objects of type dragon and then test its functions. You will also declare and define (in its own pair of header and implementation files) a class to represent peasant.
Here are the specifications for your classes:
dragon class:
member data:
a positive integer for the number of consummate Vs he/she has.
a positive integer for the number of beefy arms he/she has.
his/her majesty level - 1, 2, or 3.
a member indicating whether or not he/she is a "wingaling" dragon.
and, of course, a name.
member functions:
a default constructor that builds a dragon with 17 Vs,1 arm of the beefy kind, majesty of 2 (sort of average), and is a wingaling-er. Now we have to give it a name......"Trogdor" (the BURNINATOR)
a constructor that takes arguments for all data members.
a copy constructor.
a print() function that will print out the dragon so that you can see what the dragon is. Of course, you will eventually replace this with a overloaded insertion operator. If you know how to do that, do it instead.
a burninate() function that returns a bool indicating whether or not the peasant object passed to it was set afire. Currently, there is a correspondence between a dragon's majesty and his/her success rate at setting afire any peasant. This is how it works: majesty value of 1 has a 50% burn rate; majesty of 2 has a 70% rate; and majesty of 3 has a 90% burn rate.
set (mutator) functions for all data members.
peasant class:
member data:
name
weight
on fire or not
is alive
member functions
appropriate constructors. Your default constructor should name the peasant "default", give him/her a wt randomly chosen in the interval [90,120], be alive and not on fire.
appropriate set function(s). You will find that you will definitely need to have a set function for on_fire, since a dragon may be successful in setting afire any given peasant.
a eat() function that will increment wt
a starve() function that will decrement wt
appropriate get function(s).
a print() function that will allow inspection of what the peasant is.
When you submit: Your code will require no user interaction. Your driver should declare and test objects to show that your classes indeed work. You will be graded on how complete your driver is.
As always, if you have questions, don't hesitate to ask your instructor or the LEAD GUY if you need help.