I have this program that doesn't work, they ask me to return an array with barraCaramelo, chicles and cuponesRestantes. Each of this products cost coupons barraCaramelo (10 coupons), chicles(3 coupons), and cuponesRestantes are the coupons that remains.
If someone can solve this will do me a enormous favor, I don't really understand how this line (public static int[] candyCalculator(int num_coupons)
) works, they ask me to create a public static void main(String args[])
but I don't know how to do it.
Thanks
public static int[] candyCalculator(int num_coupons) {
int barraCaramelo = num_coupons / 10;//this cost 10 coupons
int cuponesChicles = num_coupons % 10;
int chicles = cuponesChicles / 3;// cost 3
int cuponesRestantes = cuponesChicles % 3;//coupons that remain
int[] arr=new int[3];
arr[0]=barraCaramelo;
arr[1]=chicles;
arr[2]=cuponesRestantes;
return arr;
}
public static void main(String args[]){
num_coupons=10;
int[] a=candyCalculator();
for (int i=0;i<4;i++){
System.out.print(a[i]);
}