Help with average amount formulas

Just finished the code for an Invoice application. I think my formulas for calculating the average invoice amount and the average discount amount are wrong, my numbers are not matching up. Can anyone help with the formulas?

import java.util.Scanner;

public class ModifiedInvoiceApp

{

public static void main(String[] args)

{

// welcome the user to the program

System.out.println("Welcome to the Invoice Total Calculator");

System.out.println(); // print a blank line

// create a Scanner object named sc

Scanner sc = new Scanner(System.in);

// perform invoice calculations until choice is equal to "n" or "N"

String choice = "y";

int InvoiceCount = 0;

while (!choice.equalsIgnoreCase("n"))

{

// get the invoice subtotal from the user

System.out.print("Enter subtotal: ");

double subtotal = sc.nextDouble();

// calculate the discount amount and total

double discountPercent= 0.0;

if (subtotal >= 500)

discountPercent = .25;

else if (subtotal >= 100)

discountPercent = .1;

else

discountPercent = 0.0;

double discountAmount = subtotal * discountPercent;

double total = subtotal - discountAmount;

// display the discount amount and total

String message1 = "Discount percent: " + discountPercent + "\n"

+ "Discount amount: " + discountAmount + "\n"

+ "Invoice total: " + total + "\n";

System.out.println(message1);

// see if the user wants to continue

System.out.print("Continue? (y/n): ");

choice = sc.next();

// display the number of invoices, average invoice amount, and average discount amount

InvoiceCount = InvoiceCount + 1;

double averageInvoiceAmount = total / InvoiceCount;

double averageDiscountAmount = discountAmount / InvoiceCount;

String message2 = "\n" +

"Number Of Invoices: " + InvoiceCount + "\n"

+ "Average Invoice Amount: " + averageInvoiceAmount + "\n"

+ "Average Discount Amount: " + averageDiscountAmount + "\n";

System.out.println(message2);

}

}

}

Also, the message displaying the number of invoices, average invoice amount, and average discount is only supposed to show when the user ends the program. What am I doing wrong?