The files must be called <LastInitialFirstInitialUnit2Ch10.java>
Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter.
Only submit the .java file needed to make the program run. Do not submit the .class file or any other file.
5%
Style Components
Include properly formatted prologue, comments, indenting, and other style elements as shown in Chapter 2 starting page 64 and Appendix 5 page 881-892.
5%
Topics covered in chapter
Topics with * are covered in this assignment.
*Array List class
*Storing Primitives in Array List
*Array List vs standard Array
Linked List class
List interface
Queues, Stacks, and Array Deque class
*Java Collections
Basic Requirements
Write a program that simulates rolling 2 dice and keeps track of the results.
This is similar to the previous assignment but is using Array Lists rather than regular Array’s.
LiFiUnit2Ch10.java
Declare an Array List of size 11 to track rolls 2-12. (an unsorted Array List)
Ask how many rolls are to be performed
Create 2 random numbers, each between 1 and 6 to simulate the dice
Fill each elements in the Array List with total of the 2 dice.
Store the number of rolls of 2 in the first element, 3 in the second, 4 in the third, etc up to 12 in the 11th element.
Print a table showing the rolls, historical and percentage of total rolled (see
90%
sample).
After the table, print a total row which calculates the total rolls and the total percentage. Ensure to calculate these values and don’t just hard code based on number of rolls at the top.
Ensure the dashed line under historical is only as long as the value below it (see example below).
o Hint: You can use the Integer wrapper class to convert the integer to a string and then determine the length of it.
Finally, print out which roll was rolled most and how many times it was rolled. (Seem sample)
Hint: Use the collections class to search for the max value in your arrayList
Sample output is provided below. Be sure to mimic it exactly except for the number of rolls, historical, and percentage which will change.
10%
NOTE: Complete your activity and submit it by clicking “Submit Assignment”
Total Percentage
100%
Sample Your output will vary based on the number of rolls entered
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more