Drop_of_Rain
asked on
linking code together
The numbers that are generated through this code needs to go into an arraylist in the same order. I have to be able to have each number to be associated to an audio file which are in a hashmap linked to a checkbox. I have the code for the hashmap to checkboxs if needed
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;
import java.lang.*;
public class TestIt {
public static void main(String[] args) {
printRows();
}
// Generate numbers fir training
static void printRows() {
final int INDEX_LIMIT = 8;
final int BATCH_LENGTH_LIMIT = 8;
final int BATCH_SIZE = 4;
final int NUM_BATCH_GROUPS = 4;
int batchLength = 4;
// Disallow duplicates by using a Set
Set numbers = new HashSet();
for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {
// Add numbers if more needed
while (numbers.size() < batchLength && batchLength < BATCH_LENGTH_LIMIT) {
numbers.add(new Integer((int)(Math.random( ) * INDEX_LIMIT) + 1));
}
for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {
java.util.List list = new ArrayList(numbers);
// Shuffle and print
Collections.shuffle(list);
System.out.println(list);
}
batchLength++;
System.out.println();
}
}
}
// Checkboxs to audio files Audio files to Checkboxs
public class CheckBoxesToAudioFiles {
Map checkToAudio;
public CheckBoxesToAudioFiles {
checkToAudio = new HashMap();
}
public void mapCheckboxToAudioFile(JCh eckbox cb, AudioFile af) {
checkToAudio.put(cb, af);
}
public AudioFile getAudioFileForCheckbox(JC heckbox cb) {
(AudioFile)return checkToAudio.get(cb);
}
}
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;
import java.lang.*;
public class TestIt {
public static void main(String[] args) {
printRows();
}
// Generate numbers fir training
static void printRows() {
final int INDEX_LIMIT = 8;
final int BATCH_LENGTH_LIMIT = 8;
final int BATCH_SIZE = 4;
final int NUM_BATCH_GROUPS = 4;
int batchLength = 4;
// Disallow duplicates by using a Set
Set numbers = new HashSet();
for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {
// Add numbers if more needed
while (numbers.size() < batchLength && batchLength < BATCH_LENGTH_LIMIT) {
numbers.add(new Integer((int)(Math.random(
}
for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {
java.util.List list = new ArrayList(numbers);
// Shuffle and print
Collections.shuffle(list);
System.out.println(list);
}
batchLength++;
System.out.println();
}
}
}
// Checkboxs to audio files Audio files to Checkboxs
public class CheckBoxesToAudioFiles {
Map checkToAudio;
public CheckBoxesToAudioFiles {
checkToAudio = new HashMap();
}
public void mapCheckboxToAudioFile(JCh
checkToAudio.put(cb, af);
}
public AudioFile getAudioFileForCheckbox(JC
(AudioFile)return checkToAudio.get(cb);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No I'm making a training program. And cin use all the help I can get.
Can you tell me what you need to accomplish about your question above ?
ASKER
If you could go to this question you will get an understanding of what I am trying to accomplish with the program.
https://www.experts-exchange.com/questions/20933110/code-for-a-pattern.html
What I need first is to be able to have the numbers that are generated from this code to be stored into a source (I'll leave that up to you) in the same order as they are generated. I then need those stored numbers to be linked to an audio file in a hashmap. (the code above)
https://www.experts-exchange.com/questions/20933110/code-for-a-pattern.html
What I need first is to be able to have the numbers that are generated from this code to be stored into a source (I'll leave that up to you) in the same order as they are generated. I then need those stored numbers to be linked to an audio file in a hashmap. (the code above)
ASKER