Introduction One of the challenges of programming is the possibility of simulating real life activities. In this lab we are trying to simulate the throwing of dice and to test the statistics and probability. This can be done by counting the number of times that cach face of the dice appears in a cecrtain number of throws. The program we aiming to develop starts by prompting the user to enter the number of throws he'she would like to roll the dice. The program should then randomly roll that dice and to keep a record of cach face for every throw. Such requirements lend itself to the use of arrays as the natural and optimal choice. Therefore, first step is to prompt the user of the number of throws. This, in turn, can be used to construct the array that represent the number of choices. Furthermore, it would be more appropriate is to throw the dice and record these throws by assigning each element on the array to the actual face that is found. The listing below shows the start of the program and each student is to complete the program as per the followings requirements listed under tasks. Simple program that simulates the rolling of a dice a certain number of throws. a method that calculate the nunber of times each face appears in the ralling process Author: Dr. Farid Thrahim The program is then call import java.util.Scanner; public class Rolldice { public static void main(string[] args) { Scanner input = new Scanner (System.in); System.out.print("How many times would you like to throw the dice : "); int roll - input.nextint(); int [] dice = /l your code here + System.out.println("\n\nkolling the dice new int [rol1]; roll " times")i I/ call the required method + public static void get Face YourFirstName 47 (.){ I/ write the body of the function Task: Dr. Farid Ibrahim

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
I need the answer as soon as possible
Introduction
One of the challenges of programming is the possibility of simulating real life activities. In this
lab we are trying to simulate the throwing of dice and to test the statistics and probability. This can
be done by counting the number of times that cach face of the dice appears in a certain number of
throws. The program we aiming to develop starts by prompting the user to enter the number of
throws he'she would like to roll the dice. The program should then randomly roll that dice and to
keep a record of each face for every throw.
Such requirements lend itself to the use of arrays as the natural and optimal choice. Therefore,
first step is to prompt the user of the number of throws. This, in turn, can be used to construct
the array that represent the number of choices. Furthermore, it would be more appropriate is
to throw the dice and record these throws by assigning each element on the array to the actual face
that is found.
The listing below shows the start of the program and each student is to complete the program as
per the followings requirements listed under tasks.
Simple program that simulates the rolling of a dice
a certain number of throws.
a method that calculate the number of times each
face appears in the ralling process
Author: Dr. Farid Ibrahim
The program is then call
import java.util.Scanner;
public class RollDice {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print("How many times would you like to throw the dice : ");
int roll - input.nextint();
int [] dice =
// your code here
System.out.println("\n\nRolling the dice roll " times");
: ");
new int [rol1];
Il call the required method.
public static void get Face YourFirstName 47 (...) {
I/ write the body of the function
Task:
Dr. Farid Ibrahim
SWE201 Structured Programming
Lab Two
FALL 2021
You are required to complete the code of the program above to satisfy the following conditions:
1. Insert your name as the author
2. Write the code to roll the dice as per the number of elements in the array.
3. Upon filling all the elements of the array, you are required to call the method
getFace_YourFirstName_47> Where YourFirstName is the student first name and 47 is
the 4th and 7th digit of the student's ID.
4, Your code should send the array to the method and to get the number of every face occurred
during the rolling of the dice and output it. Also output two faces with equal frequency (if
any).
PS: Below is a sample ourput of the program and you are required to produce similar output
format by completing the code above.
How many times would you like to throw the dice: 100
Rolling the dice 100 times
Dice with 1 point face: 16
Dice with 2 point face: 8
Dice with 3 point face: 17
Dice with 4 point face: 13
Dice with 5 point face: 17
Dice with 6 point face: 29
The faces with repeated frequency are: 3 and S
Transcribed Image Text:Introduction One of the challenges of programming is the possibility of simulating real life activities. In this lab we are trying to simulate the throwing of dice and to test the statistics and probability. This can be done by counting the number of times that cach face of the dice appears in a certain number of throws. The program we aiming to develop starts by prompting the user to enter the number of throws he'she would like to roll the dice. The program should then randomly roll that dice and to keep a record of each face for every throw. Such requirements lend itself to the use of arrays as the natural and optimal choice. Therefore, first step is to prompt the user of the number of throws. This, in turn, can be used to construct the array that represent the number of choices. Furthermore, it would be more appropriate is to throw the dice and record these throws by assigning each element on the array to the actual face that is found. The listing below shows the start of the program and each student is to complete the program as per the followings requirements listed under tasks. Simple program that simulates the rolling of a dice a certain number of throws. a method that calculate the number of times each face appears in the ralling process Author: Dr. Farid Ibrahim The program is then call import java.util.Scanner; public class RollDice { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("How many times would you like to throw the dice : "); int roll - input.nextint(); int [] dice = // your code here System.out.println("\n\nRolling the dice roll " times"); : "); new int [rol1]; Il call the required method. public static void get Face YourFirstName 47 (...) { I/ write the body of the function Task: Dr. Farid Ibrahim SWE201 Structured Programming Lab Two FALL 2021 You are required to complete the code of the program above to satisfy the following conditions: 1. Insert your name as the author 2. Write the code to roll the dice as per the number of elements in the array. 3. Upon filling all the elements of the array, you are required to call the method getFace_YourFirstName_47> Where YourFirstName is the student first name and 47 is the 4th and 7th digit of the student's ID. 4, Your code should send the array to the method and to get the number of every face occurred during the rolling of the dice and output it. Also output two faces with equal frequency (if any). PS: Below is a sample ourput of the program and you are required to produce similar output format by completing the code above. How many times would you like to throw the dice: 100 Rolling the dice 100 times Dice with 1 point face: 16 Dice with 2 point face: 8 Dice with 3 point face: 17 Dice with 4 point face: 13 Dice with 5 point face: 17 Dice with 6 point face: 29 The faces with repeated frequency are: 3 and S
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education