Question: Complete the following exercises by the due date. Make sure your source code using appropriate programming style (e.g., descriptive variable names, indenting, comments, etc.). Exercises
Complete the following exercises by the due date. Make sure your source code using appropriate programming style (e.g., descriptive variable names, indenting, comments, etc.).
Exercises
Programming Note: We are getting into the part of the course where we are transitioning from simple programs to more complicated ones. As such, it is becoming more important to adhere to good programming style.
- Using a random number generator (hint: SecureRandom), simulate the roll of a 10-sided dice (numbers between 1 and 10). Using an array of integers, keep track of the frequency each value is generated. Using a for() loop roll the dice 1,000,000 times. Print out the contents of the array.
Sample:
Face Frequency
==== =========
- 100000
- 99543
- 100492
- Etc.
- Write a program that reads an unspecified number of grades (no more than 10) and determines how many are above or equal to the average and how many are below. Print out the entire array so you can verify the result. Use a negative number as a sentinel value.
What to Turn In
For each exercise, submit the source code and the screen output.
Learning Objectives
This exercise contributes to the development of problem solving and debugging skills. After completing this exercise, students should understand the how arrays of values are handled in a programming language.
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
Exercise 1 Simulating Dice Rolls java import javasecuritySecureRandom public class DiceRollSimulatio... View full answer
Get step-by-step solutions from verified subject matter experts
