I am EXTREMELY new to programming. I am trying to write a program that allows users to enter in their college / university transcripts course by course. I would like each course to be separated in their own array and separated by spaces.
For example: ENG 105 A 3 (array 1) MAT 102 A 4 (array 2) etc...
It seems as if the input is being stored into one single array.
It would be awesome if I did not have to use a counter and the program could move on when users are done entering their courses.
import java.util.Scanner;
public class Tester{
public static void main(String[] args) {
int length;
Scanner input = new Scanner(System.in);
System.out.println("How many courses did you complete at your college / university?: ");
length = input.nextInt();
String[] courses = new String[length];
System.out.println("Follow this model when entering your courses: ENG 105 3 A");
for(int counter = 0; counter < length; counter++){
System.out.println("Course "+(counter+1));
courses[counter] = input.next();
}
input.close();
}
}
String[] coursesto beString[][] courses? To end user input you could have the user enterdoneand check for that string to exit the loop.