I am writing a programming project. My project is about the user entering money to buy the amount of chocolate bars they want to consume. Each chocolate bar contains 1 coupon. 1 chocolate bar equals $1. redeeming 6 coupons will get the user 1 free bar plus the extra coupon in the free bar. For example if the user enters 6$ the user will get 6 bars redeeming 6 coupons will get a free bar so the free bar will have a coupon so the the user has one coupon left.I must print the left amount of coupons after the user redeems it.
I use this equation to get the leftover coupons
amount = coupons / 6;
When i run my code the amount prints 0 not the remaining leftovers like 1 coupon left if i buy 6 chocolate bars. Please help what am I doing wrong. Heres my code
import java.util.Scanner;
public class Chp4PP16RedeemChocolateCoupons_John {
public static void main(String[] args)
{
//Instance Variables
int CostOfBar = 1;
int ChocolateBar = 0;
int UserDollar = 0;
int Amount;
int Coupons = 0;
int Total = 0;
Scanner keyboard = new Scanner(System.in);
//Tell the user how many chocolate bars they want to buy
System.out.println("Welcome User,\nPlease enter your money to buy the amount of chocolate bars you want.\nChocolate Bar = $" + CostOfBar);
UserDollar = keyboard.nextInt();
System.out.println("You have entered $" + UserDollar+ "\n");
System.out.println("You have decided to buy");
System.out.println((Amount = UserDollar + ChocolateBar) + " Chocolate Bars.");
//get total amount and remainder of coupons
while (Coupons > 6)
{
Total = Amount / 6;
}
System.out.println("\nYou have " + Total + " remaining coupons.");
}
}