Hi I am new to programming and have been assigned "Minimum Coins Program" for a class I am taking. I have finished the main code for it and it runs fine. But part of the parameters is that if the user enters a zero the program will exit, if not the program will continue looping. I have tried looking up answers but none have worked so far.
Here is what I have, but I can't seem to grasp looping. This is our first non flowchart assignment. Also if you have any suggestions on improving what I already have that would also be appreciated(this professor is a very harsh grader).
How can I get the program to exit through the user entering zero, and how can I keep the programming looping until the user enters zero. As of now the program just runs once and when I enter zero it lists the minimum amount of change
package mincoins;
import java.util.Scanner;
public class MinCoins
{
public static void main(String[] args)
{ //start code
    //initialization
    Scanner input = new Scanner(System.in); //create input class to get change data 
    int amount, quartercount = 0, dimecount = 0, nickelcount = 0, penniecount = 0; 
    amount = 1;
    while (amount != 0)
    {
        System.out.println("Please Enter amount of change (1-99) or ZERO to EXIT");
        System.out.println("");
        amount = input.nextInt();
        {
            while (amount > 25)
            {
                amount = amount - 25;
                quartercount++;
            }
            while (amount > 10)
            {
                amount = amount - 10;
                dimecount++;
            }
            while (amount > 5)
            {
                amount = amount - 5;
                nickelcount++;
            }
            System.out.println("");
            System.out.println("Quarters: " + quartercount);
            System.out.println("Dimes: " + dimecount);
            System.out.println("Nickles: " + nickelcount);
            System.out.println("Pennies: " + amount);
            System.out.println("");
        }
    }
}//main
}//class
 
    