0

And how do I restore the array [j] [i] after the user has finished entering his information and print in output

and print all information user

I Hope my illustration was understandable

This question he gave me || Write a java program that prompt the user to insert last term’s courses and their individual mark and store them in an appropriate multidimensional array ||

 public static void main(String[] args) {
         Scanner A = new Scanner(System.in);
             System.out.print(" How many courses last semester? ");
             int da = A.nextInt( );
             int[] gar = new int[da];
             String[] courses = new String[da]; 

// I have a problem here that it print for my array number (0) (1) and save just in array (1)

for (int j=0;j< courses.length;j++){
            System.out.println("name the courses last semester " + j +" : ");
           courses[j] = A.nextLine();
                        }

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

      for (int i = 0; i < gar .length; i++) {
             System.out.print("How much is an individual mark in day " + i +" : ");
             gar [i] = A.nextInt( );
        }
            System.out.println( "The name of the course and how many degrees he got");  
         for (int j=0; j< courses.length;j++){
          System.out.println(courses[j]); 
         }
             for (int i=0;i< gar .length; i++) {            
         System.out.print(gar[i]);
        }

}
juman jl
  • 35
  • 4

0 Answers0