Please how can you go about making a concatenated string defined
int SubNo = 1;
String Student = "Student";
String Name = "Name";
String Matric = "Matric";
String Sub = "Sub";
String Score = "Score";
if (No > 0 && No < 2) {
++No;
} else if (No > 1 && No < 3) {
++No;
} else if (No > 2 && No < 4) {
++No;
} else if (No > 3 && No < 5) {
++No;
} else if (No > 4 && No < 6) {
++No;
} else if (No > 5 && No < 7) {
++No;
} else if (No > 6 && No < 8) {
++No;
} else if (No > 7 && No < 9) {
++No;
} else if (No > 8 && No < 10) {
++No;
}
switch(No) {
case 11: System.out.println ("Error, Maximum number of students reached");
break;
}
String N = Integer.toString (No);
//1
System.out.println("Please imput your Name");
Student.concat(N).concat(Name) = sc.next();
System.out.println("\n"+"Hello "+
Student.concat(N).concat(Name)+","+
" Welcome to Student Group Score Calculator");
I intend to make a loop instance whereby a different variable in the loop defines each input, for example, if I input 1 in the first instance, 4 in the second instance and 7 in the third instance. I want it to save each of my input in these instances with student1Name, student2Name & student3Name.
I've tried using the concatenate method but it doesn't work, also if you have a better way of doing this, please share