We need to develop a game that allows two players to throw a dice ten times and the player who gets the highest sum wins the game. Write a method sum(int[] values) that returns the sum of elements of the array values. Write a method display(int[] values) that displays the elements of the array values. • Write a main method where you should: a) Create two arrays of integers called player1 and player2 with size 10 both b) For each player, generate ten random integers between 1 and 6 inclusively. The generated values are added to the associated array of each player. c) Display the generated values for each player. d) Find and display the winner using the sum method. I Sample run1 Generated numbers for player 1 are: 6 6 31 2 1 4 65 4 Generated numbers for player 2 are: 6 2 2 4 2 1 1 52 4 Player 1 wins with score 38 Sample run2 Generated numbers for player 1 are: 352 32 1465 4 Generated numbers for player 2 are: 5 3 3 2 2 1 65 4 4 Draw with score 35
We need to develop a game that allows two players to throw a dice ten times and the player who gets the highest sum wins the game. Write a method sum(int[] values) that returns the sum of elements of the array values. Write a method display(int[] values) that displays the elements of the array values. • Write a main method where you should: a) Create two arrays of integers called player1 and player2 with size 10 both b) For each player, generate ten random integers between 1 and 6 inclusively. The generated values are added to the associated array of each player. c) Display the generated values for each player. d) Find and display the winner using the sum method. I Sample run1 Generated numbers for player 1 are: 6 6 31 2 1 4 65 4 Generated numbers for player 2 are: 6 2 2 4 2 1 1 52 4 Player 1 wins with score 38 Sample run2 Generated numbers for player 1 are: 352 32 1465 4 Generated numbers for player 2 are: 5 3 3 2 2 1 65 4 4 Draw with score 35
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Modularization Techniques
Section: Chapter Questions
Problem 2GZ
Related questions
Question
100%
Please solve it by java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage