ics array simulate dice rolls

36 views Asked by At

Write a program that will simulate the roll of 3 dice, and keep track of the total of each roll. The program will ask the user for the number of rolls, then it will make that many rolls, and your program will keep track of the frequency of each total that resulted. This type of data is commonly called frequency data, as we are tracking the frequency of each roll. Once rolls are completed, your program should:

(a) Display a summary of the frequency data. List each possible total (from 3 to 18), display the number of occurrences of that total, and a percentage of that frequency over all other frequencies.

(b) Calculate and display the mean of the totals. The mean is the average and its calculated by adding up all the values and divided by the number of values. If possible, your final answer should be rounded to one decimal place.

(c) Determine and display the mode of the marks. The mode of a group of values is the value that occurs most often in the group. A group may have more than one mode if more than one value occurs with the maximum frequency. Such a group is said to be multi-modal.

(d) Determine and display the median of the marks. The median is the middle value from an ordered list of all the values. If there are an odd number of values, the median will be the middle value. If there are an even number of values, the median is the average of the two values adjacent to the middle.

if possible I would like help on this and see the steps on how to do all the parts for the code also analyse my code to see if i'm on track for anything and feel free to judge my coding skills feelings wont be hurt and if it does or doesn't get help still thanking you anyways. :) also its Arrays i'm doing.

import java.util.*;


public class A6{


  public static void main(String[] args) { 

    Scanner keyboard = new Scanner(System.in);

     System.out.println("Enter number of rolls");
     int[] dice1 = new int [1+6];
     dice1[0] = keyboard.nextInt();

     System.out.println("Enter number of rolls");
     int[] dice2 = new int [1+6];
     dice2[1] = keyboard.nextInt();

     System.out.println("Enter number of rolls");
     int[] dice3 = new int [1+6];
     dice3[2] = keyboard.nextInt();

     int maxClassSize = 3;

     System.out.println(dice1);
0

There are 0 answers