CSIS 212 Programming Assignment 5 Variable-Length Argument List Dice Rolling



Exercise 6.14 JHTP: (Variable-Length Argument List) Write an application that calculates the product of a series of integers that are passed to method product using a variable-length argument list. Test your method with several calls, each with a different number of arguments.
Exercise 6.17 JHTP: (Dice Rolling) Write an application to simulate the rolling of two dice. The application 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 clause will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent. Figure 6.21 shows the 36 possible combinations of the two die. Your application should roll the dice 36,000 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in a tabular format.
CSIS212 Assignment 5 Report
CSIS212 Assignment 5 Screenshot
CSIS212 Assignment 5 Screenshot
The solution consists of:
A report word document for this assignment
All Java programs in case you want to run theses programs on your computer.
Screenshots while running programs
Attachments [Move over files to preview content of those files] (308.39 KB)
Source Code
xxxxxx xxxxx xxxxxxxx614 {
xxxxxx xxxxxx xxxx xxxx(xxxxxx[] xxxx) {
int product; if (args.length == 0) System.out.println(“No Command Line arguments”); else { product = 1; for (int i = 0; i < args.length; i++) { int n = Integer.parseInt(args[i]); xxxxxxx *= x; }"xxx xxxxxxx xx x xxxxxx xx xxxxxxxx "); xxx (xxx x = 0; x < xxxx.xxxxxx; x++)[x] + " ");" xx: " + xxxxxxx); Preview xxxxxx xxxx.xxxx.xxxxxx; xxxxxx xxxxx xxxxxxxx617 { public static void main(String[] args) { Random random = new Random(System.currentTimeMillis()); int freq[] = new int[13]; int[] dice = new int[2]; System.out.println("Roll dice 36000 times:"); for (int i = 1; i <= 36000; i++) { dice[i % 2] = 1 + random.nextInt(6);[x % 2]); xx (x % 2 == 0) { xxxx[xxxx[1] + xxxx[0]]++; } }"xxxxxx xx xxxxx xxxx xxxxxxxx xxx xxxxxxx.:"); Price: $19 You May Also Like: CSIS 212 Programming Assignment 1 Create Five Programs CSIS 212 Programming Assignment 2 Salary Calculator CSIS 212 Programming Assignment 3 Bar Chart Printing Program CSIS 212 Programming Assignment 4 Multiples Circle Area Computer-Assisted Instruction CSIS 212 Programming Assignment 6 Date Class CSIS 212 Programming Assignment 7 Rectangle Class CSIS 212 Programming Assignment 8 Payroll Modification


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.