Project 1


Project #1
Design a class to represent a uniformly distributed integer random number. The class must be named aRandomNumber. Use your class to generate a random number in a specified range.
Show the frequency distribution of your numbers when 9,000 tosses are made and the random number is instantiated to generate numbers between 1 and 9 (inclusive). In other words, show how many times the numbers 1,2,3,….and 9 have appeared.
The output displayed on the screen should look like:

1 —– 900
2 —– 950
Up to
9 —- 1011
Meaning that the number one appeared 900 times (your mileage may vary), and so on.

The output should also have a section displaying a histogram.
The histogram should look something like this:
1 xxxxxxxxxxxxxx
2 xxxxxxxxxxxxxx
9 xxxxxxxxxxxxxx

Where the ‘x’ represent some number of occurrence of a particular face. Since you are likely to get 100’s of occurrences of a face you will not be able to use one x for one occurrence. Therefore you will have to scale your x to represent some number of occurrences.

Make sure your class has a constructor that allows you to instantiate aRandomNumber which will take the low and high ends of the desired range.
The class should have a method with prototype:
int aRandomNumber::generate();
which will generate a random integer belonging to the specified range.
Also provide a method called setRange(int low, int high) which will allow a client to change the range of integers generated by the generate() method.

You will need to make sure to use data hiding principles. Make sure you use Public and Private access rights appropriately.
Not using data hiding principles will result in a 10% penalty

Make sure you have a appropriate constructors and destructors.
Not having the appropriate constructors will result in a 10% penalty

Do not use a switch statement to update the counts in the histogram!
Using a switch statement in the updating method of your histogram will result in a 20% penalty.

Your code must compile. If your code doesn’t compile you will automatically receive a grade of 0.

Your executable must run. If not you will automatically receive a grade of 0.

If your code doesn’t display the histogram and counts appropriately you will suffer a penalty of at least 50% depending on the cause of the error.

You will submit your project through the digital drop box feature of blackboard. You will zip your project and submit the zipped file.


There are no reviews yet.

Be the first to review “OBJECT ORIENTED DESIGN Project 1”

Your email address will not be published.