How to aggregate values stored inside an array in java
<p>I am creating a simple games score report generator program which takes input and turns it into a .txt file. It takes a name, a game name, an achievement score and minutes played and I want to be able to tally up the amount of games input, add up the achievement score and also add up the minutes (and convert to hours).</p>

<p>This is an example of how my output to .txt looks at the moment - </p>

<p><img src="https://i.gyazo.com/92e94009821e3ba376fb0f4669bae281.png" alt=""></p>

<p>This is an example of how I would like an output to look - </p>

<p><img src="https://i.gyazo.com/52886a647eca59c6e75ec3b7c05e03d9.png" alt=""></p>

<p>How do I aggregate data that was input into the console and stored in an array to get results that I want?</p>

<pre><code>PrintWriter writer = new PrintWriter(new FileOutputStream("Gaming Report Data", true));
writer.println("Player : " + gamerName);
writer.println();
writer.println("--------------------------------");
writer.println();
String[] report = gamerReport.split(":");
writer.println("Game: " + report[0] + ", score= " +report[1] + ", minutes played= " +report[2]);
writer.println();
writer.close();
</code></pre>

<p>Source code </p>

<pre><code>package JavaProject;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.nio.file.*;



public class JavaProject {

    private static final int minutesPlayed = 0;
    private static char[] input;

    public static void main(String[] args) {


        //variables 
        int hrs = minutesPlayed * 60;
        int mins;   
        String gamerName, gamerReport = null;
        int gameCount;
        int errorCount;


        //Main data storage arrays
        String[] gameNames = new String[100];
        int[] highScores = new int[100];
        int[] minutesPlayed = new int [100];

        @SuppressWarnings("resource")
        Scanner Scan = new Scanner(System.in);

        //formatting for output and input
        System.out.println("////// Game Score Report Generator \\\\\\\\\\\\");
        System.out.println("     ");

        //User enters either their name or quit. Entering a name will move on to next part
        for ( ; ; )
        {
            System.out.print("Enter your Name.");
            System.out.println("   ");
            gamerName = Scan.nextLine();


            for(int b = 1; b &lt; 99; b++ ) { //this is making the code loop 100 times




        //user is given an example of input format 
        System.out.println("    ");
        System.out.println("Input Gamer Information " + "Using Format --&gt; Game : Achievement Score : Minutes Played");
        System.out.println("FALSE DATA FORMAT WILL CAUSE ERROR");
        System.out.println("    ");

        //another data input guide which is just above where data input is in console
        System.out.println("Game : Achievement Score : Minutes Played");
        gamerReport = Scan.nextLine();

        String[] splitUpReport; // an array of string


        if (gamerReport.equalsIgnoreCase("quit")) {
            System.out.println("You have quit!");
            return;
        }
        splitUpReport = gamerReport.split(":");


        int i = 0;

        //copy data from split text into main data storage arrays 
        gameNames[i] = splitUpReport[0];
        highScores[i] = Integer.parseInt(splitUpReport[1].trim() );
        minutesPlayed[i] = Integer.parseInt(splitUpReport[2].trim());




        //output to file using a PrintWriter using a FileOutPutStream with append set to true within the printwriter constructor
        //

        try
        {

            PrintWriter writer = new PrintWriter(new FileOutputStream("Gaming Report Data", true));
            writer.println("Player : " + gamerName);
            writer.println();
            writer.println("--------------------------------");
            writer.println();
            String[] report = gamerReport.split(":");
            writer.println("Game: " + report[0] + ", score= " +report[1] + ", minutes played= " +report[2]);
            //writer.println("Games Played : " + minutesPlayed);
            writer.close();





        } catch (IOException e)
        {
            System.err.println("You have made an error with data input");
        }

        }
        System.out.println("You have quit!");
            }



    }




    public static char[] getInput() {
        return input;
    }

    public static void setInput(char[] input) {
        JavaProject.input = input;
    }

}
</code></pre>