
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

package alphabet;
import java.util.ArrayList; import java.util.Random; import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) { Random generator = new Random();
ArrayList letters = new ArrayList(); for (char c='A'; c<'Z'; c++) letters.add(c);
for(int i = 0; i < 5; i++) { int x = 25; int r = generator.nextInt(x); System.out.println("The random numbers are: "+ r); x--; letters.remove(r); }
String word = JOptionPane.showInputDialog("Please Enter Word in CAPS: ");
String message = "i have all characters ";
System.out.println("The word is: "+ word);
for(int i = 0; i < word.length(); i++) { if (letters.contains(word.substring(i))) { JOptionPane.showMessageDialog(null, message); break; } else JOptionPane.showMessageDialog(null, message = "i dont have all characters "); break; } }