Hi, having trouble with this code. Can't figure out how to tell the code to keep printing firstname lastname and etc.. based on what number of students the user enters and how to keep storing it.
package studentscoresapp; import java.util.ArrayList; import java.util.Scanner; public class StudentScoresapp { public static void main(String[] args) { // display a welcome message System.out.println("Welcome to the Future Value Calculator"); System.out.println(); // perform 1 or more calculations Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")){ System.out.println("Welcome to The Student Scores Application."); System.out.println("Enter number of students to score: "); int numbofStudents = sc.nextInt(); System.out.println("Student lastname: "); String lastName = sc.nextLine(); System.out.println("Student firstname: "); String firstName = sc.nextLine(); System.out.println("Student Score: "); String studentScore = sc.nextLine(); ArrayList<String> students = new ArrayList<>(); //add number of strings students.add(lastName); students.add(firstName); students.add(studentScore); //print the array list for (int i = 0; i < students.size(); i++){ String student = students.get(i); System.out.println(student); } // see if the user wants to continue System.out.print("Continue? (y/n): "); choice = sc.next(); System.out.println(); } } }