Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Generate 100,000,000 random numbers in the range 0..9,999. For each number generated, determine the last digit and count the occurrence of the last digit. [

Generate 100,000,000 random numbers in the range 0..9,999. For each number generated, determine the last digit and count the occurrence of the last digit. [ you are not holding the 100,000,000 in memory inside the loop generate #, determine last digit, increment appropriate counter ]

You can either use 10 counters, or you can use 1 array of 10 ints ( 0..9 ) for the counter.

After all of the numbers are generated, report the counts by digit.

Sample Run

Last

Digit Count

0 9,995,956

1 10,003,864

2 9,997,903

3 9,997,796

4 9,999,679

5 10,000,971

6 10,006,986

7 9,999,226

8 9,999,525

9 9,998,094

Press any key to continue . . .

Grading Rubric (50 points for Part A)

name in a comment at the top (2 points)

Class/file name (5 points) (naming convention starts with upper case, subsequent words upper case)

Variable Declarations (5 points) (datatypes and naming convention starts with lower case, subsequent words upper case)

Constants (all caps with _ for separating words) (2 points)

Loop to generate 100,000,000 random numbers (10 points)

Determining the last digit (7 points)

Adding to the appropriate counter (7 points)

neatly displaying each digit and its tally (7 points)

proper indenting (5 points) body of class indented, body of methods indented, body of loop indented

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions