Here's a small bit of code I've been working on. I'm on the beginner's side but I've hit a small roadblock that I can't seem to work around. Here is my code so far:
import java.util.Scanner;
public class Question5
{
public static void main(String args[])
{
int m, n, i, j;
Scanner sc=new Scanner(System.in);
m = 100;
n = 6;
int array[][] = new int[m][n];
System.out.println("Enter the elements of the array, beginning with the first two lines of a song's lyrics, musical key for the song, beats per minute, the artist and the year realeased: ");
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
array[i][j] = sc.nextInt();
System.out.println("Yours track inputs were: ");
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
System.out.print(array[i][j] + " ");
System.out.println();
}
}
}
When executing my code, it seems that it only takes inputs for integers, but as my title suggests I'm seeking for each input to be represented as a sentence followed by a comma, then the following info, but like the information that System.out.println("Enter the elements of the array, beginning with the first two lines of a song's lyrics, musical key for the song, beats per minute, the artist and the year released: "); suggests, considering each row would consist of these values.
Granted, as you can see, the array would be quite large, so I tested it in shorter terms, such as 10x2 or 5x5, where it functioned as I imagined, yet I would only need to be able to input the sentences. Thus, I'm practicing the principle of the code working on a larger scale on theory, as I believe it should be unless I am corrected here.
Thank you in advance. Quite the journey I'm on.
p.s: I understand this is probably a newbish question, although I can't seem to find the answer anywhere in regards to my code. Apologies in advance for that as well.
Edit: As requested, here would be an example with changing the value of m to 1 and n to 6
What I envision is that I would input, say: the information as listed in bold in a sequence:
Please enter lyrical line one, line two, Artist, Release Year, Beats, Key:
This is lyrical line one
This is lyrical line two
Artist
2021
10
Eb
Your track inputs were:
This is lyrical line one, This is lyrical line two, Artist, 2021, 10, Eb
And thus that would end the program. Thank you.
The main intention of my code is to have an array hold 100 tracks, store information