50 points
Some political scientists are interested in examining the gender, race,
sexual orientation, nationality, and religion of people.
The administrators have incomplete lists of each demographic that is
being tracked.
Thus, before analysis can begin, the administrators want to update the demographics.
(You will need to use vectors since they are dynamic).
You are to write a program that permits administrators
to update demographic classifications and then creates a histogram of the
demographics of a population.
The political scientists want to examine these characteristics:
- gender
- race
- sexual orientation
- nationality
- religion
When the program starts, it is to begin in administrator mode and permit
data to be added to any/all of the above characteristics in any order. Thus user
should be able to add to a characteristic multiple times
After the administrator is done,
the software
is to start normal input mode which permits different population groups
to be analyzed.
Your assignment must use inheritance. Create a base demographic class, each
of the demographics will be derived classes. The base class would include
the demographic name, number of characteristics in the demographic, and if you wish, a demographic numeric id so that you do not have to constantly
compare strings.
Each derived class will include a vector of the characteristics currently
defined.
The derived class must include sets and gets as appropriate.
Initially, use the following ("hard code" this data in your program in the
constructor of the appropriate derived class)
-
gender: male, female
-
race: white, africanAmerican, americanIndian, asian, latino
-
sexualOrientation: gay, lesbian, bisexual
-
nationality: english, german, italian, irish, mexican, japanese, puertoRican,
french, polish, scottish, dutch, swedish, norwegian, british, welsh, african,
american, chinese
-
religion:christian, jewish, muslim, buddhist
Next, permit the administrator to add data to the characteristics from the KEYBOARD.
- the administrator must be
permitted to selct groups until he/she is done (selects exit from the menu)
- input must be by name (i.e., string)
- you cannot assume the order that the demographic classifications
will be entered
When the administrator is "done", the program should start data collection mode.
- Prompt the user to enter data (in text format) about an individual
- Permit the user to enter the data in any order
You cannot make any assumptions such as gender is entered before race
For example, either of the following are the same:
atheist agnostic done
agnostic atheist done
- Input for the administrator
- The user will enter "done" at the end of input
- Display the five histograms
Use the following KEYBOARD input to test your code:
- Administrator input
gender
intersexual pansexual transgender
done
orientation
straight done
race
nativeHawaiian done
religion
atheist agnostic done
nationality
turkish korean australian greek saudiaArabian
hungarian portugese ukrainian iranian
done
done
- sample input for the data collection
- german straight male atheist nativeHawaiian done
- africanAmerican female bisexual christian african done
- gay male white norwegian atheist done
- english female straight christian asian done
- korean intersexual bisexual white agnostic done
- female jewish polish straight latino done
- latino buddhist puertoRican male gay done
- male white bisexual swedish agnostic done
- straight male africanAmerican british christian done
- female lesbian christian swedish white done
- africanAmerican male saudiaArabian bisexual muslim done
- white female pansexual atheist greek done
- done
Histogram format must visually show the relative differences.
For example:
Gender
male: * * * *
female: * * * * *
asexual: * * *
Submit your code, sample run, and user directions to the Demographic dropbox