HOMEWORK 11 - CLASS FUN
The Purpose
The purpose of this homework is twofold, to give you more practice on (1) writing your own objects and (2) using objects of classes written by others. You can learn how to work with objects from others by looking at the member functions provided in the class.
The Goal: Part I
The goal of this homework is to create a unique class of a "magic item", which allows the user of the "magic item" to do something and then, perhaps, win something. Your "magic item" can (and should) have different behaviors than the "magic items" created by your fellow students. For example, a "magic item" may ask a riddle and, if answered correctly, awards a potOfGold. In addition to answering a riddle, other example behaviors are solving a math problem, answering a trivia question, playing a slot machine, etc.
The Goal: Part II
You are also required to write a main.cpp
that uses your
"magic item" and three other
"magic items" written this semester by others. Your
main.cpp
should first welcome the user, and then tell the user
what he/she must do to win a prize. Then, allow the user to use the objects
(created from the "magic items" chosen) to determine what prizes the
user wins.
Examples
To illustrate this "magic item" idea,
example 1 and
example 2 are provided. You are not allowed
to use these "magic items" in your main.cpp
(nor
copy the example code to create your own "magic item" class
either!)
Code Sharing
Before sharing your "magic item" class with another, you should include both your name and CSCI 261 section number in both files associated with your "magic item" class. In other words, your "magic item" class is your work; make sure you take credit for it!
In your main.cpp
file, also include all names of people
you shared your "magic item" class with.
If you are interested in having others use your awesome "magic item" class, feel free to post an advertisement on Piazza (with your email address so students can contact you for a copy of your code). Do NOT post your "magic item" class on Piazza. Also, please post your advertisement as a NOTE (not a question).
There will be a prize for the author of the "magic item" class that is used the most! Be creative!!
Note: you can NOT post an advertisement for your "magic item" before Thursday, April 7th, at 5pm MT.
A Few Requirements
To receive full credit, the following requirements must be met:
- Your "magic item" class should have at least two data members and, in
addition to constructors and getter/setter functions, at
least three other member functions. One of these other functions should be
an
Introduction()
function that tells the user how to use the "magic item" to win a prize. - Both files associated with your "magic item" class should include
your name and CSCI 261 section number. In addition,
your
main.cpp
file, must include all names of people you shared your "magic item" class with. - Your
main.cpp
must use at least three "magic items" written by others, as well as let the user know whether he/she won the prize.
Homework Grade and Submission
Your Homework 11 grade will be based on your solution to this assignment and your solution to Lab11A, Lab11B, and Lab11C. In submitting your homework assignment (due Apr 13th), follow these steps:
- create a directory called week11.
- within week11, create 4 subdirectories: Lab11A, Lab11B, Lab11C, and HW11.
- copy all files in your src directory from your Lab11A solution (should be several files) to your new week11/Lab11A directory.
- copy all files in your src directory from your Lab11B solution (should be several files) to your new week11/Lab11B directory.
- copy all files in your src directory from your Lab11C solution (should be several files) to your new week11/Lab11C directory.
- copy all files in your src directory from your HW11 solution (should be several files) to your new week11/HW11 directory.
- compress the week11 directory (see Step 3 here for details).
- submit the week11.zip file to Blackboard (see Steps 5-11 here for details).
- after you submit, download the file and double check it contains all that you think it contains!