• Write a line of code that declares and creates a 100-element array of ints.
  • Initialize all the elements in the array of Question #1 to 1.
  • Write a line of code that accesses the seventh element of the array in Question#2 and sets its value to 7.
  • Write a method printArray that displays the contents of the array created in Question#1. Assume that the method receives array1 as an argument in a method call. Display the contents of the array with each number separated by a space. In addition, start a new line after every 20 elements.
  • Create a char array and use an array initializer to initialize the array with the characters in the string "Hi there". Display the contents of the array using a for statement. Separate each character in the array with a space.
  • Write a for statement that prints only "Hi" from the array you created in Question#5.
  • Write a program to simulate the rolling of two dice. The program should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 being the least frequent sums. Your application should roll the dice 36,000 times. Use a one dimensional array to keep track of the number of times each possible sum appears. Display the results in tabular format. Determine whether the totals are reasonable (e.g., here are six ways to roll a 7, so approximately one-sixth of the rolls should be 7).

Sample output:

Sum Frequency Percentage
2 1027 2.85
3 2030 5.64
4 2931 8.14
5 3984 11.07
6 5035 13.99
7 5996 16.66
8 4992 13.87
9 4047 11.24
10 2961 8.23
11 1984 5.51
12 1013 2.81
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.