Write a program to store in a 2-d boolean array of size 5


Part 1

1. Generate 100 random number between 1 and 6.

2. Print out in each line:
a line number starting by line 1, follow by as many "*"s as 1's were generated; line 2 as many "*"s as 2's were generated and so on, to line 6.

Example:

If 20 1's were generated you should print:

Line 1 ********************

3. Do not forget to enter your name as a comment.

4. Screenshot of program and output.

Part 2

1. Write a program to store in a 2-D boolean array of size 5 and 10 a true value if a random value is less than 0.5 else false. Print only the indexes of cells with true value.

2. Screen shot of program and output.

Part 3

A large number of college students are attending a party. Each guest is drinking a can of beer or soda or lemonade or coconut. An emergency causes the lights to go out and the fire alarm to go off. The guests calmly put down their can and exit the building. When the alarm goes off, they re-enter and try to retrieve their can. However, the lights are still off, so each student randomly grabs a can. How many students if any got his or her original can?

1. Write a program to simulate this event, assuming there are N guests. Print out how many students got his or her original can.

2. Screenshot of program and output. Do not forget your name as a comment

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a program to store in a 2-d boolean array of size 5
Reference No:- TGS01008652

Expected delivery within 24 Hours