Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Below is a sample input file. It is a puzzle with lots of names of mammals embed

ID: 3566965 • Letter: B

Question

Below is a sample input file. It is a puzzle with lots of names of mammals embedded in

it. Some of the word matches appear below the puzzle.

22 22

Z T V W L R E V A E B Y W E S O O M P F Z L

Q B T W M T A F R I C A N W I L D D O G M F

M H O A R Y M A R M O T L V N Y T M B K L F

N C H I M P A N Z E E H G O X P Z Z A O M L

W I L D Y A K N N W A N I K L B R N R L L Y

M M R N N W J J K T R L G Z X D G I L L M I

R O B V X G Z A E G N B H C B A D J F P J N

M U A T H L N E G A F P T A R A T R T T C G

Y N G M H N H N C U P R B O M R N H C N V S

C T A L E C O I A T A O O A K L A R K P H Q

E A M R R R R B Y T O R N Y R N H A D M I U

L I E L U F I R B N U A W B K J P E T Z P I

E N R V A M I C K I T G Y L V L E B P Y P R

P G I G C P E R A E G R N R R L L R F T O R

H O C T A E M L E N J M F A A H E A P Z P E

A A A T Q F L J K C B P N E R Z N L L M O L

N T N K L F E Z J C D A S R N O A O E Y T X

T J M Q Q A X L E N A P D L W V C P M T A B

S Z I L M R G N K B R L L G T T I M A N M B

E N N Z P I L C G A R F B B E G R T C R U L

A C K T L G L R H P L A K M T R F P K W S M

L R R L X K A D N A P T N A I G A J P Z M G

Camel Gibbon Mountain Goat

African Lion Cheetah Giraffe Orangutan

African Wild Dog Chimpanzee Harp Seal Polar Bear

American Badger Elephant Seal Hippopotamus Tapir

American Mink Elk Hoary Marmot Wild Yak

Baboon Florida Manatee Jaguar Zebra

Beaver Flying Squirrel Kangaroo

Black Lemur Giant Panda

(multi-word mammals simply have spaces removed in the puzzle)

Explanation / Answer

Code for the Puzzle import javax.swing.*; import java.io.*; import java.util.*; import java.awt.*; import java.awt.event.*; public class WordPuzzleSearch extends JFrame implements ActionListener { public static String file = null; public static void main(String[] args) { new WordPuzzleSearch(); } JRadioButton Cars; JRadioButton Brands; JRadioButton Animals; JLabel Title; JLabel Title2; JLabel Select; JButton btnStart; JButton btnExit; JButton btnHowToPlay; public static DefaultListModel listModel; public WordPuzzleSearch() { // GUI Frame this.setSize(900,700); this.setTitle("Ultimate Word Search Puzzleeee!"); this.setLocation(240, 10); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(null); //Fonts Font f = new Font("Chaparral Pro Light", Font.BOLD,30); Font title = new Font("Chaparral Pro Light", Font.BOLD,45); //Labels Title2 = new JLabel("ULTIMATE WORD SEARCH GAME!"); Title2.setBounds(200,100,700,75); Title2.setFont(title); this.add(Title2); Title = new JLabel("WELCOME TO THE"); Title.setBounds(100,50,700,50); Title.setFont(f); this.add(Title); Select = new JLabel("Select the category:"); Select.setBounds(50, 250, 300, 50); Select.setFont(f); this.add(Select); // Buttons btnStart = new JButton("Start Game!"); btnStart.setBounds(640, 275, 200, 50); btnStart.setFont(f); this.add(btnStart); this.setVisible(true); btnStart.addActionListener(this); btnHowToPlay = new JButton("How To Play?"); btnHowToPlay.addActionListener(this); btnHowToPlay.setBounds(640, 360, 200, 50); btnHowToPlay.setFont(f); this.add(btnHowToPlay); btnExit = new JButton("Exit"); btnExit.setBounds(640, 600, 200, 50); btnExit.setFont(f); btnExit.addActionListener(this); this.add(btnExit); btnExit.setVisible(true); //Radio Buttons Cars = new JRadioButton("Cars"); Cars.setBounds(50, 300, 150, 50); Cars.setFont(f); Cars.addActionListener(this); this.add(Cars); Brands = new JRadioButton("Brands"); Brands.setBounds(200, 300, 150, 50); Brands.setFont(f); Brands.addActionListener(this); this.add(Brands); Animals = new JRadioButton("Animals"); Animals.setBounds(350, 300, 150, 50); Animals.setFont(f); Animals.addActionListener(this); this.add(Animals); ButtonGroup group = new ButtonGroup(); group.add(Cars); group.add(Brands); group.add(Animals); } public void actionPerformed(ActionEvent e) { if (e.getSource() == btnStart) { if (Cars.isSelected()) { file = ("Cars.txt"); } else if (Brands.isSelected()) { file = ("Brands.txt"); } else if (Animals.isSelected()) { file = ("Animals.txt"); } Interface2 NG = new Interface2(); } else if (e.getSource() == btnHowToPlay) { Object[] options = {"I'm Ready!"}; int a = JOptionPane.showOptionDialog (null,"Visit the page: "+"http://justwordsearch.com// "+"for more info on how to play the game! :)", "How to Play", JOptionPane.INFORMATION_MESSAGE, JOptionPane.NO_OPTION, null, options, options[0]); } else if (e.getSource() == btnExit) System.exit(0); } } class Interface2 extends JFrame implements ActionListener { JButton btncheck = new JButton(); JButton btnreset = new JButton(); JButton btnQuit = new JButton(); JPanel Container = new JPanel(); JPanel ButtonsContainer = new JPanel(); JPanel arrayPanel = new JPanel(); JPanel sidePanel = new JPanel(); JButton button[] [] = new JButton[20][20]; Container btnArea = getContentPane (); BufferedReader BR = null; DefaultListModel listModel = new DefaultListModel(); String filename = WordPuzzleSearch.file; String[] wordarray = null; public Interface2() { { this.setVisible(true); this.setSize(1350,700); this.setBackground(Color.black); JList lbx = new JList(listModel); lbx.setSize(250,600); lbx.setFixedCellHeight(30); lbx.setFixedCellWidth(250); lbx.setFont(new Font("Arial",Font.BOLD,14)); lbx.setBackground(Color.green); this.add(lbx); btncheck.setSize(300,200); btncheck.setLabel("Check Words"); btncheck.addActionListener(this); btncheck.setBackground(Color.green); btncheck.setForeground(Color.black); this.add(btncheck); btnQuit.setSize(300,200); btnQuit.setLabel("Quit Game"); btnQuit.addActionListener(this); btnQuit.setBackground(Color.green); btnQuit.setForeground(Color.black); this.add(btnQuit); btnreset.setSize(300,200); btnreset.setLabel("Reset"); btnreset.addActionListener(this); btnreset.setBackground(Color.green); btnreset.setForeground(Color.black); this.add(btnreset); ButtonsContainer.setBackground(Color.black); ButtonsContainer.setLayout(new GridLayout (20,20)); arrayPanel.setBackground(Color.black); arrayPanel.add(lbx); sidePanel.setBackground(Color.black); sidePanel.add(btncheck); sidePanel.add(btnreset); sidePanel.add(btnQuit); Container.setBackground(Color.black); } { try { FileInputStream wordsFile = new FileInputStream("C:\Eclipse\File\src\"+filename); BR= new BufferedReader(new InputStreamReader(wordsFile)); } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(null, "File is not found"); } try { wordarray = new String[10]; for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote