Hello friends, who can help me to add the columns 8 and 9 of the matrix of this code?
import java.util.Scanner;
public class Project {
static String matrix;
static int ccites=0;
static Scanner sc=new Scanner (System.in);
public static void main(String arg) {
int option=1;
matrix=new String[18][11];
do { System.out.println("Enter: \n1 To record the information of a soccer match played by the Colombia national team "
- “\n2 To display the information of all the matches played by the Colombian national team” + "\n3 To display the information of all the matches played by the Colombian national team "
- "\n3 To show the number of matches played by the Colombia national team " + "\n4 To modify the number of matches played by the Colombia national team "
To modify or update the information of a match taking into account its date " + "\n4 To modify or update the information of a match taking into consideration its date " - "\n5 To show the information of the matches where there has been a red card for some of the teams. "
- "\n6 To calculate the average number of goals per match (the goals scored by both teams are considered). "
- "\n7 To display the name of the team that scored the most goals ");
option=sc.nextInt();
switch(option){
case 1: register_match();
break;
case 2: show_all_match_information();
break;
case 3: System.out.println("The number of matches played by the Colombian national team were "+ccites);
break;
case 4: modify_match_information();
break;
case 5: Sumatarjetas();
break;
}
}while(option>=1 && option<=7);
}
public static void register_match() {
System.out.println(“Enter the information about the match”);
array[quotes][0]=String.valueOf(quotes+1);
System.out.println(“Enter the name of the opponent”);
array[ccites][1]=sc.next();
System.out.println(“Enter the number of goals scored by colombia”);
array[ccitas][2]=sc.next();
System.out.println(“Enter the number of goals scored by the opponent”);
array[ccitas][3]=sc.next();
System.out.println(“Enter the place where the match was played”);
array[ccitas][4]=sc.next();
System.out.println(“Enter the debut date (DD/MM/YEAR)”);
array[ccitas][5]=sc.next();
System.out.println(“Enter the number of yellow cards for colombia during the match”);
array[ccitas][6]=sc.next();
System.out.println(“Enter the number of yellow cards for the opponent during the match”);
array[ccitas][7]=sc.next();
System.out.println(“Enter the number of red cards for colombia during the match”);
array[ccitas][8]=sc.next();
System.out.println(“Enter the number of red cards for the opponent during the match”);
array[ccitas][9]=sc.next();
ccites++;
}
public static void show_all_match_information() {
for(int i=0; i<ccites; i++) {
System.out.println(“-----------------------------------------------”);
System.out.println(“Match #”+array[i][0]);
System.out.println("Seleccion colombia vs "+matriz[i][1]);
System.out.println("Goals scored by colombia: "+matrix[i][2]);
System.out.println("Goals scored by opponent: "+matrix[i][3]);
System.out.println("Place of debut: "+array[i][4]);
System.out.println("Date: "+array[i][5]);
System.out.println("Yellow cards for Colombia: "+array[i][6]);
System.out.println("Yellow cards for Opponent: "+array[i][7]);
System.out.println("Red cards for Colombia: "+array[i][8]);
System.out.println("Red cards for the Opponent: "+matrix[i][9]);
System.out.println();
}}
public static void modify_match_info() {
String cod;
System.out.println(“Enter the number of the match you want to modify”);
cod=sc.next();
for(int i=0; i<ccites; i++) {
if(cod.contentEquals(matrix[i][5])) {
System.out.println(“Enter the name of the opponent”);
array[i][1]=sc.next();
System.out.println(“Enter the number of goals scored by colombia”);
array[i][2]=sc.next();
System.out.println(“Enter the number of goals scored by the opponent”);
array[i][3]=sc.next();
System.out.println(“Enter the place where the match was played”);
array[i][4]=sc.next();
System.out.println(“Enter the debut date (DD/MM/YEAR)”);
array[i][5]=sc.next();
System.out.println(“Enter the number of yellow cards for colombia during the match”);
array[i][6]=sc.next();
System.out.println(“Enter the number of yellow cards for the opponent during the match”);
array[i][7]=sc.next();
System.out.println(“Enter the number of red cards for colombia during the match”);
array[i][8]=sc.next();
System.out.println(“Enter the number of red cards for the opponent during the match”);
array[i][9]=sc.next();
System.out.println(“The date match " +cod+” has been modified.");
}}}
Translated with www.DeepL.com/Translator (free version)