Create a 2-D array containing the data :
Pakistan Sweden France Iran China
Japan Russia China Italy China
China Japan Korea India Pakistan
India China Egypt Lebanon Korea
Australia N.Z. Sweden Vanuatu Korea
Indonesia China Vietnam Russia New Guinea
Create EITHER two 2-D arrays ( lose 1/ 2 mark ), or one 3-D array containing the data :
7 4 0 1
0 0 0 0
0 1 1 2
1 2 0 2
0 2 6 1
2 1 2 1
1 1 2 0
1 0 0 1
0 1 1 1
2 1 0 2
0 1 1 3
4 1 0 2
The first column in the array of countries is the Home team in a Football match, and the other names are the teams which they played against, Game1, Game2, Game3 and Game4. The second array is Home team scores, and the third array is Away team scores.
For example, Pakistan’s Game1 home match was against Sweden, and the score was 7-1 in Pakistan’s favour. When Pakistan played Iran in Game3, they lost 0-2.
When Australia was at home to N.Z. in Game1 , it was a 0-0 draw. Australia beat Vanuatu 6-1 in Game3.
Write a Java program to search these arrays.
The user will enter the name of a Country, and also state which game ( 1, 2, 3 or 4 ).
( For example, Pakistan’s Game1 was a 2-1 win against Sweden ).
In a second option, allow the user to enter the name of a Country. List all the Home matches and results for that Country.
( If the user enters China, the display will be
Japan 0_0 Korea 1_1 India 1-1 Pakistan 2_1 )
Pakistan Sweden France Iran China
Japan Russia China Italy China
China Japan Korea India Pakistan
India China Egypt Lebanon Korea
Australia N.Z. Sweden Vanuatu Korea
Indonesia China Vietnam Russia New Guinea
Create EITHER two 2-D arrays ( lose 1/ 2 mark ), or one 3-D array containing the data :
7 4 0 1
0 0 0 0
0 1 1 2
1 2 0 2
0 2 6 1
2 1 2 1
1 1 2 0
1 0 0 1
0 1 1 1
2 1 0 2
0 1 1 3
4 1 0 2
The first column in the array of countries is the Home team in a Football match, and the other names are the teams which they played against, Game1, Game2, Game3 and Game4. The second array is Home team scores, and the third array is Away team scores.
For example, Pakistan’s Game1 home match was against Sweden, and the score was 7-1 in Pakistan’s favour. When Pakistan played Iran in Game3, they lost 0-2.
When Australia was at home to N.Z. in Game1 , it was a 0-0 draw. Australia beat Vanuatu 6-1 in Game3.
Write a Java program to search these arrays.
The user will enter the name of a Country, and also state which game ( 1, 2, 3 or 4 ).
( For example, Pakistan’s Game1 was a 2-1 win against Sweden ).
In a second option, allow the user to enter the name of a Country. List all the Home matches and results for that Country.
( If the user enters China, the display will be
Japan 0_0 Korea 1_1 India 1-1 Pakistan 2_1 )
Comment