Question: C++ code must use standard namespace Develop an abstract base class RandGen that will be used for generating random numbers or strings in various questions.
C++ code must use standard namespace
Develop an abstract base class RandGen that will be used for generating random numbers or strings in various questions. Give some supporting (mathematical) arguments for all your work in your report. Use library functions from the standard library like rand), srand() and time(). I suggest you use srand(time(0) to seed the random number generator. Create four derived classes RandLotto, RandDay, RandTime and RandString. The RandLotto will be used to generate random drawings for California Super Lotto Plus based on 5 numbers from 1 to 47 and one additional Mega number from 1 to 27. See www.Calottery.com/ games/superlotteryplus for Lottery rules. The RandDay will generate a random day of the year, use the class Date from the textbook. Make sure you look into the case of leap years to make it absolutely random. The RandTime will generate a random time of the day using class Time from textbook. The RandString will be used as a base class for two derived classes: RandStr will generate a random strings at most 256 characters long and a RandMsgOfTheDay will return a random message of the day (use a table of messages in memory- or in a file). Test all your classes. Use the classes from problem above for the following: Try to find what are your chances to win the California Super Lottery through a computer simulation. I suggest you keep generating random Super Lotto draws in a loop until you win, say 100 times. Try to have a significant number of wins before you draw a conclusion.
I // Fig. 9.25: Time.h 2 // Time class modified to enable cascaded member-function calls. 3 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
