Write a program that creates two arrays of size 8 representing card numbers in a game. The valid numbers are between 1 and 9 only. The user must enter 8 valid numbers to fill the first array. Then, the program must generate 8 random numbers to fill the second array. The program must display the numbers generated and then how many matching card numbers (equal value) at the same index in both arrays respectively. Sample run 1: Enter 8 card numbers between 1 and 9: 2 1 47 39 8 5 The cards generated by the computer are: 5 49 2 4 79 2 You have o matching card (s). Sample run 2: 3 e5 9 2 8 1 9 Enter 8 card numbers between 1 and 9: The cards generated by the computer are: 6 e8 8 5 7 4 5 You have 1 matching card (s).

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
100%
What is the solution of this problem using java language?
Write a program that creates two arrays of size 8 representing card numbers
in a game. The valid numbers are between 1 and 9 only.
The user must enter 8 valid numbers to fill the first array. Then, the
program must generate 8 random numbers to fill the second array.
The program must display the numbers generated and then how many
matching card numbers (equal value) at the same index in both arrays
respectively.
Sample run 1:
Enter 8 card numbers between 1 and 9:
2 1 4 7 3 9 8 5
The cards generated by the computer are:
5 4 9 2 4 79 2
You have 0 matching card (s).
Sample run 2:
Enter 8 card numbers between 1 and 9:
3 45 9 2 8 19
The cards generated by the computer are:
6 48 85 7 4 5
You have 1 matching card (s).
Your answer
Transcribed Image Text:Write a program that creates two arrays of size 8 representing card numbers in a game. The valid numbers are between 1 and 9 only. The user must enter 8 valid numbers to fill the first array. Then, the program must generate 8 random numbers to fill the second array. The program must display the numbers generated and then how many matching card numbers (equal value) at the same index in both arrays respectively. Sample run 1: Enter 8 card numbers between 1 and 9: 2 1 4 7 3 9 8 5 The cards generated by the computer are: 5 4 9 2 4 79 2 You have 0 matching card (s). Sample run 2: Enter 8 card numbers between 1 and 9: 3 45 9 2 8 19 The cards generated by the computer are: 6 48 85 7 4 5 You have 1 matching card (s). Your answer
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Multithreading Methods
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT