I cant figure out how to input all the money amounts,which is stored in the array (case_value), into the other array, (cases).I am trying to do this randomly. My program does run but never finishes. This is what i have so far. In case you couldn't guess, I am trying to copy the format of deal or no deal. Also, if there is any way to make my code more efficient, I would appreciate it. Thank you for the help.
import java.util.Scanner;
import java.lang.Math;
public class DOND
{
public static void main (String [] args)
{
Scanner sc = new Scanner (System.in);
int [] cases=new int [26]; //array for the cases
int [] case_value=new int [26]; //array for the money amounts
int b=0;
case_value[0]=1; // all the money amounts
case_value[1]=2;
case_value[2]=5;
case_value[3]=10;
case_value[4]=25;
case_value[5]=50;
case_value[6]=75;
case_value[7]=100;
case_value[8]=200;
case_value[9]=300;
case_value[10]=400;
case_value[11]=500;
case_value[12]=750;
case_value[13]=1000;
case_value[14]=5000;
case_value[15]=10000;
case_value[16]=25000;
case_value[17]=50000;
case_value[18]=75000;
case_value[19]=100000;
case_value[20]=200000;
case_value[21]=300000;
case_value[22]=400000;
case_value[23]=500000;
case_value[24]=750000;
case_value[25]=1000000;
for (int i=0;i<26;i++) //distributing the money
{
while (cases[b]==0); //checks if case is filled
{
int r=(int)(Math.random()*26); //randomizes money amounts in case
if (cases[r]==0)
{
b=r;
cases[r]=case_value[i]; //inserts money amount in case
}
}
}
for (int i=0;i<26;i++) //outputs value in cases
{
System.out.println(cases[i]);
}
}
}