I can get the program to add the preset values into the csv file but I want to adjust it so the user can enter the student ID Char(6) and the Student Mark (max 100) and also ensuring a minus mark cant be entered. How would I go about doing this?
public class Practicalassessment {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
       System.out.println("Enter the Students ID:  ");
       scanner scanner = new scanner (System.in);
       String ID = scanner.nextline();
       System.out.println("You have selected Student" + ID);
       System.out.println("Enter the Students Mark");
       scanner scanner1 = new scanner(System.in);
       String mark = scanner1.nextLine();
       System.out.println("You Have Entered" + mark);
       String filepath = ("marks.txt");
       newMarks(ID,mark,filepath);
    }
    public static void newMarks (String ID, String mark, String filepath) throws IOException
    {
        try
        {
            FileWriter fw = new FileWriter(filepath,true);
            BufferedWriter bw = new BufferedWriter (fw);
            PrintWriter pw = new PrintWriter (bw);
            pw.println(ID+","+mark);
            pw.flush();
            pw.close();
            JOptionPane.showMessageDialog(null, "Records Updated Sucessfully");
        }
        catch (Exception E)
        {
            JOptionPane.showMessageDialog(null, "Records Unable to Be Updated");
        }
    }
}
 
     
    