Java Assignment and 3 page paper for Jaque

profilejohndoe74
week_4_individual_assignment.zip

Week 4 Individual Assignment/build.xml

Builds, tests, and runs the project JohnDoe.

Week 4 Individual Assignment/build/classes/.netbeans_automatic_build

Week 4 Individual Assignment/build/classes/.netbeans_update_resources

Week 4 Individual Assignment/build/classes/com/toy/anagrams/lib/StaticWordLibrary.class

package com.toy.anagrams.lib;
final synchronized class StaticWordLibrary extends WordLibrary {
    private static final String[] WORD_LIST;
    private static final String[] SCRAMBLED_WORD_LIST;
    static final WordLibrary DEFAULT;
    private void StaticWordLibrary();
    public String getWord(int);
    public String getScrambledWord(int);
    public int getSize();
    public boolean isCorrect(int, String);
    static void <clinit>();
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/lib/WordLibrary.class

package com.toy.anagrams.lib;
public abstract synchronized class WordLibrary {
    protected void WordLibrary();
    public static WordLibrary getDefault();
    public abstract String getWord(int);
    public abstract String getScrambledWord(int);
    public abstract int getSize();
    public abstract boolean isCorrect(int, String);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/About$1.class

package com.toy.anagrams.ui;
synchronized class About$1 implements java.awt.event.ActionListener {
    void About$1(About);
    public void actionPerformed(java.awt.event.ActionEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/About.class

package com.toy.anagrams.ui;
public synchronized class About extends javax.swing.JDialog {
    private javax.swing.JButton closeButton;
    private javax.swing.JTextArea copyrightTextArea;
    private javax.swing.JPanel mainPanel;
    public void About(javax.swing.JFrame);
    private void initComponents();
    private void closeButtonActionPerformed(java.awt.event.ActionEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/About.form

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams$1.class

package com.toy.anagrams.ui;
final synchronized class Anagrams$1 implements Runnable {
    void Anagrams$1();
    public void run();
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams$2.class

package com.toy.anagrams.ui;
synchronized class Anagrams$2 extends java.awt.event.WindowAdapter {
    void Anagrams$2(Anagrams);
    public void windowClosing(java.awt.event.WindowEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams$3.class

package com.toy.anagrams.ui;
synchronized class Anagrams$3 implements java.awt.event.ActionListener {
    void Anagrams$3(Anagrams);
    public void actionPerformed(java.awt.event.ActionEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams$4.class

package com.toy.anagrams.ui;
synchronized class Anagrams$4 implements java.awt.event.ActionListener {
    void Anagrams$4(Anagrams);
    public void actionPerformed(java.awt.event.ActionEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams$5.class

package com.toy.anagrams.ui;
synchronized class Anagrams$5 implements java.awt.event.ActionListener {
    void Anagrams$5(Anagrams);
    public void actionPerformed(java.awt.event.ActionEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams$6.class

package com.toy.anagrams.ui;
synchronized class Anagrams$6 implements java.awt.event.ActionListener {
    void Anagrams$6(Anagrams);
    public void actionPerformed(java.awt.event.ActionEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams.class

package com.toy.anagrams.ui;
public synchronized class Anagrams extends javax.swing.JFrame {
    private int wordIdx;
    private com.toy.anagrams.lib.WordLibrary wordLibrary;
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JPanel buttonsPanel;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JLabel feedbackLabel;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JButton guessButton;
    private javax.swing.JLabel guessLabel;
    private javax.swing.JTextField guessedWord;
    private javax.swing.JMenuBar mainMenu;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JButton nextTrial;
    private javax.swing.JLabel scrambledLabel;
    private javax.swing.JTextField scrambledWord;
    public static void main(String[]);
    public void Anagrams();
    private void initComponents();
    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent);
    private void nextTrialActionPerformed(java.awt.event.ActionEvent);
    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent);
    private void guessedWordActionPerformed(java.awt.event.ActionEvent);
    private void exitForm(java.awt.event.WindowEvent);
}

Week 4 Individual Assignment/build/classes/com/toy/anagrams/ui/Anagrams.form

Week 4 Individual Assignment/build/classes/Hello/Hello.class

package Hello;
public synchronized class Hello {
    public void Hello();
    public static void main(String[]);
}

Week 4 Individual Assignment/build/classes/Program/HalsCommission.class

package Program;
public synchronized class HalsCommission {
    public void HalsCommission();
    public static void main(String[]);
}

Week 4 Individual Assignment/build/classes/Program/NumberGeneration.class

package Program;
public synchronized class NumberGeneration {
    public void NumberGeneration();
    public static void main(String[]);
}

Week 4 Individual Assignment/build/classes/Program/NumberGenerator1.class

package Program;
public synchronized class NumberGenerator1 {
    public void NumberGenerator1();
    public static void main(String[]);
}

Week 4 Individual Assignment/build/classes/Program/SalesCommission.class

package Program;
public synchronized class SalesCommission {
    private int fixedSalary;
    private double commission;
    public int sales;
    private double salesTarget;
    private double acceleration;
    public void SalesCommission();
    public void SalesCommission(int, double);
    public void setFixedSalary(int);
    public void setCommission(double);
    public void setSalesTarget(double);
    public void setAcceleration(double);
    public int getFixedSalary();
    public double getCommission();
    public double getSalesTarget();
    public double getAcceleration();
}

Week 4 Individual Assignment/Main/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar

META-INF/MANIFEST.MF

Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.2 Created-By: 1.7.0_25-b15 (Oracle Corporation) NetBeans-Own-Library: true

org/netbeans/modules/java/j2seproject/copylibstask/Bundle.properties

# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # # Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. # # Oracle and Java are registered trademarks of Oracle and/or its affiliates. # Other names may be trademarks of their respective owners. # # The contents of this file are subject to the terms of either the GNU # General Public License Version 2 only ("GPL") or the Common # Development and Distribution License("CDDL") (collectively, the # "License"). You may not use this file except in compliance with the # License. You can obtain a copy of the License at # http://www.netbeans.org/cddl-gplv2.html # or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the # specific language governing permissions and limitations under the # License. When distributing the software, include this License Header # Notice in each file and include the License file at # nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this # particular file as subject to the "Classpath" exception as provided # by Oracle in the GPL Version 2 section of the License file that # accompanied this code. If applicable, add the following below the # License Header, with the fields enclosed by brackets [] replaced by # your own identifying information: # "Portions Copyrighted [year] [name of copyright owner]" # # Contributor(s): # # The Original Software is NetBeans. The Initial Developer of the Original # Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun # Microsystems, Inc. All Rights Reserved. # # If you wish your version of this file to be governed by only the CDDL # or only the GPL Version 2, indicate your decision by adding # "[Contributor] elects to include this software in this distribution # under the [CDDL or GPL Version 2] license." If you do not indicate a # single choice of license, a recipient has the option to distribute # your version of this file under either the CDDL, the GPL Version 2 or # to extend the choice of license to its licensees as provided above. # However, if you add GPL Version 2 code and therefore, elected the GPL # Version 2 license, then the option applies only if the new code is # made subject to such option by the copyright holder. TXT_README_FILE_NAME=README.TXT TXT_README_FILE_CONTENT=========================\n\ BUILD OUTPUT DESCRIPTION\n\ ========================\n\ \n\ When you build an Java application project that has a main class, the IDE\n\ automatically copies all of the JAR\n\ files on the project's classpath to your project's dist/lib folder. The IDE\n\ also adds each of the JAR files to the Class-Path element in the application\n\ JAR file's manifest file (MANIFEST.MF).\n\ \n\ To run the project from the command line, go to the dist folder and\n\ type the following:\n\ \n\ java -jar '"{0}'" \n\ \n\ To distribute this project, zip up the dist folder (including the lib folder)\n\ and distribute the ZIP file.\n\ \n\ Notes:\n\ \n\ * If two JAR files on the project classpath have the same name, only the first\n\ JAR file is copied to the lib folder.\n\ * Only JAR files are copied to the lib folder.\n\ If the classpath contains other types of files or folders, these files (folders)\n\ are not copied.\n\ * If a library on the project's classpath also has a Class-Path element\n\ specified in the manifest,the content of the Class-Path element has to be on\n\ the project's runtime path.\n\ * To set a main class in a standard Java project, right-click the project node\n\ in the Projects window and choose Properties. Then click Run and enter the\n\ class name in the Main Class field. Alternatively, you can manually type the\n\ class name in the manifest Main-Class element.

org/netbeans/modules/java/j2seproject/copylibstask/CopyFiles.class

package org.netbeans.modules.java.j2seproject.copylibstask;
public synchronized class CopyFiles extends org.apache.tools.ant.Task {
    private java.io.File todir;
    private java.io.File iftldtodir;
    private String files;
    private String manifestproperty;
    public void CopyFiles();
    public void execute() throws org.apache.tools.ant.BuildException;
    private boolean containsTLD(java.io.File);
    public String getFiles();
    public void setFiles(String);
    public java.io.File getToDir();
    public void setToDir(java.io.File);
    public java.io.File getIfTLDToDir();
    public void setIfTLDToDir(java.io.File);
    public String getManifestProperty();
    public void setManifestProperty(String);
    static void <clinit>();
}

org/netbeans/modules/java/j2seproject/copylibstask/CopyLibs.class

package org.netbeans.modules.java.j2seproject.copylibstask;
public synchronized class CopyLibs extends org.apache.tools.ant.taskdefs.Jar {
    private static final String LIB = lib;
    private static final String ATTR_CLASS_PATH = Class-Path;
    private static final String MANIFEST = META-INF/MANIFEST.MF;
    private static final String INDEX = META-INF/INDEX.LIST;
    private static final String UTF_8 = UTF-8;
    private static final String UTF8 = UTF8;
    org.apache.tools.ant.types.Path runtimePath;
    org.apache.tools.ant.types.Path excludeFromCopy;
    private boolean rebase;
    public void CopyLibs();
    public void setRuntimeClassPath(org.apache.tools.ant.types.Path);
    public org.apache.tools.ant.types.Path getRuntimeClassPath();
    public void setExcludeFromCopy(org.apache.tools.ant.types.Path);
    public org.apache.tools.ant.types.Path getExcludeFromCopy();
    public boolean isRebase();
    public void setRebase(boolean);
    public void setEncoding(String);
    public void execute() throws org.apache.tools.ant.BuildException;
    private boolean rebase(java.io.File, java.io.File);
    private static boolean isSigned(org.apache.tools.ant.taskdefs.Manifest);
    private static void copy(java.io.InputStream, java.io.OutputStream) throws java.io.IOException;
    private static boolean isUTF8(String);
    static void <clinit>();
}

org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml

Week 4 Individual Assignment/Main/nblibraries.properties

libs.CopyLibs.classpath=\ ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar libs.CopyLibs.displayName=CopyLibs Task libs.CopyLibs.prop-version=2.0

Week 4 Individual Assignment/manifest.mf

Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build

Week 4 Individual Assignment/nbproject/build-impl.xml

Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes No tests executed. Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" Must select one file in the IDE or set run.class Must select one file in the IDE or set run.class Must select one file in the IDE or set debug.class Must select one file in the IDE or set debug.class Must set fix.includes This target only works when run from inside the NetBeans IDE. Must select one file in the IDE or set profile.class This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. Must select one file in the IDE or set run.class Must select some files in the IDE or set test.includes Must select one file in the IDE or set run.class Must select one file in the IDE or set applet.url Must select some files in the IDE or set javac.includes Some tests failed; see details above. Must select some files in the IDE or set test.includes Some tests failed; see details above. Must select some files in the IDE or set test.class Must select some method in the IDE or set test.method Some tests failed; see details above. Must select one file in the IDE or set test.class Must select one file in the IDE or set test.class Must select some method in the IDE or set test.method Must select one file in the IDE or set applet.url Must select one file in the IDE or set applet.url

Week 4 Individual Assignment/nbproject/genfiles.properties

build.xml.data.CRC32=bad3aaa2 build.xml.script.CRC32=680dfd8e [email protected] # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=bad3aaa2 nbproject/build-impl.xml.script.CRC32=0adc71e4 nbproject/[email protected]

Week 4 Individual Assignment/nbproject/private/private.properties

compile.on.save=true user.properties.file=C:\\Users\\Dk Dukes\\AppData\\Roaming\\NetBeans\\8.0\\build.properties

Week 4 Individual Assignment/nbproject/private/private.xml

file:/C:/Users/Dk%20Dukes/Documents/NetBeansProjects/JohnDoe/src/Program/SalesCommission.java file:/C:/Users/Dk%20Dukes/Documents/NetBeansProjects/JohnDoe/src/Program/HalsCommission.java

Week 4 Individual Assignment/nbproject/project.properties

annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processor.options= annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results # Uncomment to specify the preferred debugger connection transport: #debug.transport=dt_socket debug.classpath=\ ${run.classpath} debug.test.classpath=\ ${run.test.classpath} # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/JohnDoe.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.processorpath=\ ${javac.classpath} javac.source=1.6 javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= main.class= manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # To set system properties for unit tests define test-sys-prop.name=value: run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test

Week 4 Individual Assignment/nbproject/project.xml

org.netbeans.modules.java.j2seproject JohnDoe Main\nblibraries.properties

Week 4 Individual Assignment/src/com/toy/anagrams/lib/StaticWordLibrary.java

Week 4 Individual Assignment/src/com/toy/anagrams/lib/StaticWordLibrary.java

/*
 * Copyright (c) 2010, Oracle.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 *  * Neither the name of Oracle nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/* Anagram Game Application */

package  com . toy . anagrams . lib ;

/**
 * Implementation of the logic for the Anagram Game application.
 */
final   class   StaticWordLibrary   extends   WordLibrary   {

     private   static   final   String []  WORD_LIST  =   {
         "abstraction" ,
         "ambiguous" ,
         "arithmetic" ,
         "backslash" ,
         "bitmap" ,
         "circumstance" ,
         "combination" ,
         "consequently" ,
         "consortium" ,
         "decrementing" ,
         "dependency" ,
         "disambiguate" ,
         "dynamic" ,
         "encapsulation" ,
         "equivalent" ,
         "expression" ,
         "facilitate" ,
         "fragment" ,
         "hexadecimal" ,
         "implementation" ,
         "indistinguishable" ,
         "inheritance" ,
         "internet" ,
         "java" ,
         "localization" ,
         "microprocessor" ,
         "navigation" ,
         "optimization" ,
         "parameter" ,
         "patrick" ,
         "pickle" ,
         "polymorphic" ,
         "rigorously" ,
         "simultaneously" ,
         "specification" ,
         "structure" ,
         "lexical" ,
         "likewise" ,
         "management" ,
         "manipulate" ,
         "mathematics" ,
         "hotjava" ,
         "vertex" ,
         "unsigned" ,
         "traditional" };

     private   static   final   String []  SCRAMBLED_WORD_LIST  =   {
         "batsartcoin" ,
         "maibuguos" ,
         "ratimhteci" ,
         "abkclssha" ,
         "ibmtpa" ,
         "iccrmutsnaec" ,
         "ocbmnitaoni" ,
         "ocsnqeeutnyl" ,
         "ocsnroitmu" ,
         "edrcmeneitgn" ,
         "edepdnneyc" ,
         "idasbmgiauet" ,
         "ydanicm" ,
         "neacsplutaoni" ,
         "qeiuaveltn" ,
         "xerpseisno" ,
         "aficilatet" ,
         "rfgaemtn" ,
         "ehaxedicalm" ,
         "milpmeneatitno" ,
         "niidtsniugsiahleb" ,
         "niehiratcen" ,
         "nietnret" ,
         "ajav" ,
         "olacilazitno" ,
         "imrcpoorecssro" ,
         "anivagitno" ,
         "poitimazitno" ,
         "aparemert" ,
         "aprtcki" ,
         "ipkcel" ,
         "opylomprich" ,
         "irogorsuyl" ,
         "isumtlnaoesuyl" ,
         "psceficitaoni" ,
         "tsurtcreu" ,
         "elixalc" ,
         "ilekiwse" ,
         "amanegemtn" ,
         "aminupalet" ,
         "amhtmetacsi" ,
         "ohjtvaa" ,
         "evtrxe" ,
         "nuisngde" ,
         "rtdatioialn"
     };
    
     final   static   WordLibrary  DEFAULT  =   new   StaticWordLibrary ();

     /**
     * Singleton class.
     */
     private   StaticWordLibrary ()   {
     }

     /**
     * Gets the word at a given index.
     *  @param  idx index of required word
     *  @return  word at that index in its natural form
     */
     public   String  getWord ( int  idx )   {
         return  WORD_LIST [ idx ];
     }

     /**
     * Gets the word at a given index in its scrambled form.
     *  @param  idx index of required word
     *  @return  word at that index in its scrambled form
     */
     public   String  getScrambledWord ( int  idx )   {
         return  SCRAMBLED_WORD_LIST [ idx ];
     }

     /**
     * Gets the number of words in the library.
     *  @return  the total number of plain/scrambled word pairs in the library
     */
     public   int  getSize ()   {
         return  WORD_LIST . length ;
     }

     /**
     * Checks whether a user's guess for a word at the given index is correct.
     *  @param  idx index of the word guessed
     *  @param  userGuess the user's guess for the actual word
     *  @return  true if the guess was correct; false otherwise
     */
     public   boolean  isCorrect ( int  idx ,   String  userGuess )   {
         return  userGuess . equals ( getWord ( idx ));
     }

}

Week 4 Individual Assignment/src/com/toy/anagrams/lib/WordLibrary.java

Week 4 Individual Assignment/src/com/toy/anagrams/lib/WordLibrary.java

/*
 * Copyright (c) 2010, Oracle.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 *  * Neither the name of Oracle nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/* Anagram Game Application */

package  com . toy . anagrams . lib ;

/**
 * Interface defining logic for the Anagram Game application.
 */
public   abstract   class   WordLibrary   {
     /**
     * Constructor for subclasses.
     */
     protected   WordLibrary ()   {
     }
    
     /** Getter for the default implementation of the WordLibrary.
     *  @return  some default implementation of WordLibrary
     */
     public   static   WordLibrary  getDefault ()   {
         return   StaticWordLibrary . DEFAULT ;
     }

     /**
     * Gets the word at a given index.
     *  @param  idx index of required word
     *  @return  word at that index in its natural form
     */
     public   abstract   String  getWord ( int  idx );

     /**
     * Gets the word at a given index in its scrambled form.
     *  @param  idx index of required word
     *  @return  word at that index in its scrambled form
     */
     public   abstract   String  getScrambledWord ( int  idx );

     /**
     * Gets the number of words in the library.
     *  @return  the total number of plain/scrambled word pairs in the library
     */
     public   abstract   int  getSize ();

     /**
     * Checks whether a user's guess for a word at the given index is correct.
     *  @param  idx index of the word guessed
     *  @param  userGuess the user's guess for the actual word
     *  @return  true if the guess was correct; false otherwise
     */
     public   abstract   boolean  isCorrect ( int  idx ,   String  userGuess );
}

Week 4 Individual Assignment/src/com/toy/anagrams/ui/About.form

Week 4 Individual Assignment/src/com/toy/anagrams/ui/About.java

Week 4 Individual Assignment/src/com/toy/anagrams/ui/About.java

/*
 * Copyright (c) 2010, Oracle.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 *  * Neither the name of Oracle nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/* Anagram Game Application */

package  com . toy . anagrams . ui ;

import  java . awt . Dimension ;
import  java . awt . Point ;
import  java . awt . Rectangle ;
import  java . awt . event . ActionListener ;
import  javax . swing . JDialog ;
import  javax . swing . JFrame ;

/**
 * About dialog of the Anagram Game application.
 */
public   class   About   extends   JDialog   {

     /** Creates new form About */
     public   About ( JFrame  parent )   {
         super ( parent , true );
        initComponents ();
        pack ();
         Rectangle  parentBounds  =  parent . getBounds ();
         Dimension  size  =  getSize ();
         // Center in the parent
         int  x  =   Math . max ( 0 ,  parentBounds . +   ( parentBounds . width  -  size . width )   /   2 );
         int  y  =   Math . max ( 0 ,  parentBounds . +   ( parentBounds . height  -  size . height )   /   2 );
        setLocation ( new   Point ( x ,  y ));
     }

     /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
     private   void  initComponents ()   { //GEN-BEGIN:initComponents
        java . awt . GridBagConstraints  gridBagConstraints ;

        mainPanel  =   new  javax . swing . JPanel ();
        copyrightTextArea  =   new  javax . swing . JTextArea ();
        closeButton  =   new  javax . swing . JButton ();

        getContentPane (). setLayout ( new  java . awt . GridBagLayout ());

        setDefaultCloseOperation ( javax . swing . WindowConstants . DISPOSE_ON_CLOSE );
        setTitle ( "About Anagrams" );
        mainPanel . setLayout ( new  java . awt . GridBagLayout ());

        mainPanel . setBorder ( new  javax . swing . border . EmptyBorder ( new  java . awt . Insets ( 11 ,   11 ,   12 ,   12 )));
        copyrightTextArea . setBackground ( javax . swing . UIManager . getDefaults (). getColor ( "Panel.background" ));
        copyrightTextArea . setColumns ( 25 );
        copyrightTextArea . setEditable ( false );
        copyrightTextArea . setLineWrap ( true );
        copyrightTextArea . setRows ( 8 );
        copyrightTextArea . setText ( "Anagrams\n\nCopyright (c) 2003  Irritable Enterprises, Inc." );
        copyrightTextArea . setWrapStyleWord ( true );
        copyrightTextArea . setBorder ( null );
        copyrightTextArea . setFocusable ( false );
        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . BOTH ;
        gridBagConstraints . anchor  =  java . awt . GridBagConstraints . NORTH ;
        gridBagConstraints . weightx  =   1.0 ;
        gridBagConstraints . weighty  =   1.0 ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 24 ,   0 ,   24 ,   0 );
        mainPanel . add ( copyrightTextArea ,  gridBagConstraints );

        closeButton . setMnemonic ( 'C' );
        closeButton . setText ( "Close" );
        closeButton . addActionListener ( new  java . awt . event . ActionListener ()   {
             public   void  actionPerformed ( java . awt . event . ActionEvent  evt )   {
                closeButtonActionPerformed ( evt );
             }
         });

        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridx  =   0 ;
        gridBagConstraints . gridy  =   1 ;
        gridBagConstraints . anchor  =  java . awt . GridBagConstraints . SOUTHEAST ;
        mainPanel . add ( closeButton ,  gridBagConstraints );

        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . BOTH ;
        gridBagConstraints . weightx  =   1.0 ;
        gridBagConstraints . weighty  =   1.0 ;
        getContentPane (). add ( mainPanel ,  gridBagConstraints );

     } //GEN-END:initComponents

     private   void  closeButtonActionPerformed ( java . awt . event . ActionEvent  evt )   { //GEN-FIRST:event_closeButtonActionPerformed
        setVisible ( false );
        dispose ();
     } //GEN-LAST:event_closeButtonActionPerformed


     // Variables declaration - do not modify//GEN-BEGIN:variables
     private  javax . swing . JButton  closeButton ;
     private  javax . swing . JTextArea  copyrightTextArea ;
     private  javax . swing . JPanel  mainPanel ;
     // End of variables declaration//GEN-END:variables

}

Week 4 Individual Assignment/src/com/toy/anagrams/ui/Anagrams.form

Week 4 Individual Assignment/src/com/toy/anagrams/ui/Anagrams.java

Week 4 Individual Assignment/src/com/toy/anagrams/ui/Anagrams.java

/*
 * Copyright (c) 2010, Oracle.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 *  * Neither the name of Oracle nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/* Anagram Game Application */

package  com . toy . anagrams . ui ;

import  com . toy . anagrams . lib . WordLibrary ;
import  java . awt . Dimension ;
import  java . awt . Point ;
import  java . awt . Toolkit ;
import  javax . swing . JFrame ;
import  javax . swing . SwingUtilities ;

/**
 * Main window of the Anagram Game application.
 */
public   class   Anagrams   extends   JFrame   {

     public   static   void  main ( String []  args )   {
         /* Set the Nimbus look and feel */
         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
         try   {
            javax . swing . UIManager . LookAndFeelInfo []  installedLookAndFeels = javax . swing . UIManager . getInstalledLookAndFeels ();
             for   ( int  idx = 0 ;  idx < installedLookAndFeels . length ;  idx ++ )
                 if   ( "Nimbus" . equals ( installedLookAndFeels [ idx ]. getName ()))   {
                    javax . swing . UIManager . setLookAndFeel ( installedLookAndFeels [ idx ]. getClassName ());
                     break ;
                 }
         }   catch   ( ClassNotFoundException  ex )   {
            java . util . logging . Logger . getLogger ( Anagrams . class . getName ()). log ( java . util . logging . Level . SEVERE ,   null ,  ex );
         }   catch   ( InstantiationException  ex )   {
            java . util . logging . Logger . getLogger ( Anagrams . class . getName ()). log ( java . util . logging . Level . SEVERE ,   null ,  ex );
         }   catch   ( IllegalAccessException  ex )   {
            java . util . logging . Logger . getLogger ( Anagrams . class . getName ()). log ( java . util . logging . Level . SEVERE ,   null ,  ex );
         }   catch   ( javax . swing . UnsupportedLookAndFeelException  ex )   {
            java . util . logging . Logger . getLogger ( Anagrams . class . getName ()). log ( java . util . logging . Level . SEVERE ,   null ,  ex );
         }
         //</editor-fold>

         /* Create and display the form */
         SwingUtilities . invokeLater ( new   Runnable ()   {
             public   void  run ()   {
                 new   Anagrams (). setVisible ( true );
             }
         });
     }

     private   int  wordIdx  =   0 ;
     private   WordLibrary  wordLibrary ;

     /** Creates new form Anagrams */
     public   Anagrams ()   {
        wordLibrary  =   WordLibrary . getDefault ();
        
        initComponents ();
        getRootPane (). setDefaultButton ( guessButton );
        scrambledWord . setText ( wordLibrary . getScrambledWord ( wordIdx ));
        pack ();
        guessedWord . requestFocusInWindow ();
         // Center in the screen
         Dimension  screenSize  =   Toolkit . getDefaultToolkit (). getScreenSize ();
         Dimension  frameSize  =  getSize ();
        setLocation ( new   Point (( screenSize . width  -  frameSize . width )   /   2 ,
                               ( screenSize . height  -  frameSize . width )   /   2 ));
     }
    
     /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
     private   void  initComponents ()   { //GEN-BEGIN:initComponents
        java . awt . GridBagConstraints  gridBagConstraints ;

        mainPanel  =   new  javax . swing . JPanel ();
        scrambledLabel  =   new  javax . swing . JLabel ();
        scrambledWord  =   new  javax . swing . JTextField ();
        guessLabel  =   new  javax . swing . JLabel ();
        guessedWord  =   new  javax . swing . JTextField ();
        feedbackLabel  =   new  javax . swing . JLabel ();
        buttonsPanel  =   new  javax . swing . JPanel ();
        guessButton  =   new  javax . swing . JButton ();
        nextTrial  =   new  javax . swing . JButton ();
        mainMenu  =   new  javax . swing . JMenuBar ();
        fileMenu  =   new  javax . swing . JMenu ();
        aboutMenuItem  =   new  javax . swing . JMenuItem ();
        exitMenuItem  =   new  javax . swing . JMenuItem ();

        setTitle ( "Anagrams" );
        addWindowListener ( new  java . awt . event . WindowAdapter ()   {
             public   void  windowClosing ( java . awt . event . WindowEvent  evt )   {
                exitForm ( evt );
             }
         });

        mainPanel . setLayout ( new  java . awt . GridBagLayout ());

        mainPanel . setBorder ( new  javax . swing . border . EmptyBorder ( new  java . awt . Insets ( 12 ,   12 ,   12 ,   12 )));
        mainPanel . setMinimumSize ( new  java . awt . Dimension ( 297 ,   200 ));
        scrambledLabel . setText ( "Scrambled Word:" );
        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . HORIZONTAL ;
        gridBagConstraints . anchor  =  java . awt . GridBagConstraints . WEST ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 0 ,   0 ,   12 ,   6 );
        mainPanel . add ( scrambledLabel ,  gridBagConstraints );

        scrambledWord . setColumns ( 20 );
        scrambledWord . setEditable ( false );
        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridwidth  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . HORIZONTAL ;
        gridBagConstraints . weightx  =   1.0 ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 0 ,   0 ,   12 ,   0 );
        mainPanel . add ( scrambledWord ,  gridBagConstraints );

        guessLabel . setDisplayedMnemonic ( 'Y' );
        guessLabel . setLabelFor ( guessedWord );
        guessLabel . setText ( "Your Guess:" );
        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . HORIZONTAL ;
        gridBagConstraints . anchor  =  java . awt . GridBagConstraints . WEST ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 0 ,   0 ,   20 ,   6 );
        mainPanel . add ( guessLabel ,  gridBagConstraints );

        guessedWord . setColumns ( 20 );
        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridwidth  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . HORIZONTAL ;
        gridBagConstraints . weightx  =   1.0 ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 0 ,   0 ,   20 ,   0 );
        mainPanel . add ( guessedWord ,  gridBagConstraints );

        feedbackLabel . setText ( " " );
        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridx  =   1 ;
        gridBagConstraints . gridwidth  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . HORIZONTAL ;
        gridBagConstraints . weightx  =   1.0 ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 0 ,   0 ,   20 ,   0 );
        mainPanel . add ( feedbackLabel ,  gridBagConstraints );

        buttonsPanel . setLayout ( new  java . awt . GridBagLayout ());

        guessButton . setMnemonic ( 'G' );
        guessButton . setText ( "Guess" );
        guessButton . setToolTipText ( "Guess the scrambled word." );
        guessButton . addActionListener ( new  java . awt . event . ActionListener ()   {
             public   void  actionPerformed ( java . awt . event . ActionEvent  evt )   {
                guessedWordActionPerformed ( evt );
             }
         });

        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridheight  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . anchor  =  java . awt . GridBagConstraints . SOUTHEAST ;
        gridBagConstraints . weightx  =   1.0 ;
        gridBagConstraints . weighty  =   1.0 ;
        gridBagConstraints . insets  =   new  java . awt . Insets ( 0 ,   0 ,   0 ,   6 );
        buttonsPanel . add ( guessButton ,  gridBagConstraints );

        nextTrial . setMnemonic ( 'N' );
        nextTrial . setText ( "New Word" );
        nextTrial . setToolTipText ( "Fetch a new word." );
        nextTrial . addActionListener ( new  java . awt . event . ActionListener ()   {
             public   void  actionPerformed ( java . awt . event . ActionEvent  evt )   {
                nextTrialActionPerformed ( evt );
             }
         });

        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridwidth  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . gridheight  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . anchor  =  java . awt . GridBagConstraints . SOUTHEAST ;
        gridBagConstraints . weighty  =   1.0 ;
        buttonsPanel . add ( nextTrial ,  gridBagConstraints );

        gridBagConstraints  =   new  java . awt . GridBagConstraints ();
        gridBagConstraints . gridwidth  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . gridheight  =  java . awt . GridBagConstraints . REMAINDER ;
        gridBagConstraints . fill  =  java . awt . GridBagConstraints . BOTH ;
        gridBagConstraints . weighty  =   1.0 ;
        mainPanel . add ( buttonsPanel ,  gridBagConstraints );

        getContentPane (). add ( mainPanel ,  java . awt . BorderLayout . CENTER );

        fileMenu . setMnemonic ( 'F' );
        fileMenu . setText ( "File" );
        aboutMenuItem . setMnemonic ( 'A' );
        aboutMenuItem . setText ( "About" );
        aboutMenuItem . setToolTipText ( "About" );
        aboutMenuItem . addActionListener ( new  java . awt . event . ActionListener ()   {
             public   void  actionPerformed ( java . awt . event . ActionEvent  evt )   {
                aboutMenuItemActionPerformed ( evt );
             }
         });

        fileMenu . add ( aboutMenuItem );

        exitMenuItem . setMnemonic ( 'E' );
        exitMenuItem . setText ( "Exit" );
        exitMenuItem . setToolTipText ( "Quit Team, Quit!" );
        exitMenuItem . addActionListener ( new  java . awt . event . ActionListener ()   {
             public   void  actionPerformed ( java . awt . event . ActionEvent  evt )   {
                exitMenuItemActionPerformed ( evt );
             }
         });

        fileMenu . add ( exitMenuItem );

        mainMenu . add ( fileMenu );

        setJMenuBar ( mainMenu );

     } //GEN-END:initComponents

     private   void  aboutMenuItemActionPerformed ( java . awt . event . ActionEvent  evt )   { //GEN-FIRST:event_aboutMenuItemActionPerformed
         new   About ( this ). setVisible ( true );
     } //GEN-LAST:event_aboutMenuItemActionPerformed

     private   void  nextTrialActionPerformed ( java . awt . event . ActionEvent  evt )   { //GEN-FIRST:event_nextTrialActionPerformed
        wordIdx  =   ( wordIdx  +   1 )   %  wordLibrary . getSize ();

        feedbackLabel . setText ( " " );
        scrambledWord . setText ( wordLibrary . getScrambledWord ( wordIdx ));
        guessedWord . setText ( "" );
        getRootPane (). setDefaultButton ( guessButton );

        guessedWord . requestFocusInWindow ();
     } //GEN-LAST:event_nextTrialActionPerformed

     private   void  exitMenuItemActionPerformed ( java . awt . event . ActionEvent  evt )   { //GEN-FIRST:event_exitMenuItemActionPerformed
         System . exit ( 0 );
     } //GEN-LAST:event_exitMenuItemActionPerformed

     private   void  guessedWordActionPerformed ( java . awt . event . ActionEvent  evt )   { //GEN-FIRST:event_guessedWordActionPerformed
         if   ( wordLibrary . isCorrect ( wordIdx ,  guessedWord . getText ())){
            feedbackLabel . setText ( "Correct! Try a new word!" );
            getRootPane (). setDefaultButton ( nextTrial );
         }   else   {
            feedbackLabel . setText ( "Incorrect! Try again!" );
            guessedWord . setText ( "" );
         }

        guessedWord . requestFocusInWindow ();
     } //GEN-LAST:event_guessedWordActionPerformed

     private   void  exitForm ( java . awt . event . WindowEvent  evt )   { //GEN-FIRST:event_exitForm
         System . exit ( 0 );
     } //GEN-LAST:event_exitForm

     // Variables declaration - do not modify//GEN-BEGIN:variables
     private  javax . swing . JMenuItem  aboutMenuItem ;
     private  javax . swing . JPanel  buttonsPanel ;
     private  javax . swing . JMenuItem  exitMenuItem ;
     private  javax . swing . JLabel  feedbackLabel ;
     private  javax . swing . JMenu  fileMenu ;
     private  javax . swing . JButton  guessButton ;
     private  javax . swing . JLabel  guessLabel ;
     private  javax . swing . JTextField  guessedWord ;
     private  javax . swing . JMenuBar  mainMenu ;
     private  javax . swing . JPanel  mainPanel ;
     private  javax . swing . JButton  nextTrial ;
     private  javax . swing . JLabel  scrambledLabel ;
     private  javax . swing . JTextField  scrambledWord ;
     // End of variables declaration//GEN-END:variables

}

Week 4 Individual Assignment/src/Hello/Hello.java

Week 4 Individual Assignment/src/Hello/Hello.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package   Hello ;

/**
 *
 *  @author  Dk Dukes
 */
public   class   Hello   {
    public   static   void  main ( String  args [])
    {
        System . out . println ( "Hello World!!!" );
    }
}

Week 4 Individual Assignment/src/Program/HalsCommission.java

Week 4 Individual Assignment/src/Program/HalsCommission.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package   Program ;
import  javax . swing . * ;
import  java . text . NumberFormat ;
import  java . util . Locale ;
/**
 *
 *  @author  orengejames
 */
public   class   HalsCommission   {
     public   static   void  main ( String  args [])
     {
         int []  totalCompensation = new   int [ 2 ]   ;
         JTextArea  outText = new   JTextArea ();
         NumberFormat  moneyFormat = NumberFormat . getCurrencyInstance ( Locale . US );
         String  insert = JOptionPane . showInputDialog ( "Enter the number of people to compare" );
         int  getNumber = Integer . parseInt ( insert );
        outText . setText ( "Total Sales\tTotal Compensation\n" );
         SalesCommission  sales = new   SalesCommission ();
        sales . setCommission ( 0.06 );
        sales . setFixedSalary ( 120000 );
        sales . setSalesTarget ( 500000.00 );
        sales . setAcceleration ( 1.25 );
         String  name = "" ;
        
        for ( int  j = 0 ; j < getNumber ; j ++ )
        {
        name = JOptionPane . showInputDialog ( null , "Enter the name of the person" );
         String  input = JOptionPane . showInputDialog ( null , "Enter the annual sales" );
         double  getInput = Double . valueOf ( input );
         int  sale = sales . getFixedSalary ();
         double  com = sales . getCommission ();  
         double  comp = (( 80 * ( sales . getSalesTarget ())) / 100 );
         int  amount = ( int )(( 150 * getInput ) / 100 );
         int  saless = ( int ) getInput ;
         int  find = ( int )( saless * com );
         /*if(getInput<=comp)
        {
            for(int i=saless;i<=amount;i+=5000)
            {
                int calc=(int)(com*i);
                totalCompensation[j]=(sale+calc);
                outText.append((moneyFormat.format(i)+"\t"+moneyFormat.format(totalCompensation[j]))+"\n");
            }
        }
        else
        {
        for(int i=saless;i<=amount;i+=5000)
        {
            double newComm=(1.25*com);
            int find=(int)(newComm*i);
            totalCompensation[j]=(sale+find);           
            outText.append((moneyFormat.format(i)+"\t"+moneyFormat.format(totalCompensation[j]))+"\n"); 
        }*/
        totalCompensation [ j ] = ( sale + find );  
        
         //JOptionPane.showMessageDialog(null,"the maximum value is"+totalCompensation[j]);
         //JOptionPane.showMessageDialog(null,"the minimum value is"+totalCompensation[j+1]);
         }
         int  maxValue = totalCompensation [ 0 ];
         int  minValue = totalCompensation [ 1 ];
         if ( maxValue > minValue )
         {
             JOptionPane . showMessageDialog ( null , "the maximum value is" + maxValue + "whose owner is:" + name );
         }
         else
             JOptionPane . showMessageDialog ( null , "the maximum value is" + minValue + "whose owner is:" + name );
     }
        //JOptionPane.showMessageDialog(null,outText,"Calculation of Total Compensation",JOptionPane.INFORMATION_MESSAGE);
       
     }

Week 4 Individual Assignment/src/Program/NumberGeneration.java

Week 4 Individual Assignment/src/Program/NumberGeneration.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package   Program ;

import  javax . swing . JOptionPane ;

/**
 *
 *  @author  Dk Dukes
 */
public   class   NumberGeneration   {
     public   static   void  main ( String  args [])
     {
         int  num = 0 ;
         for ( int  i = 0 ; i < 10 ; i ++ )
         {
            num ++ ;
             JOptionPane . showMessageDialog ( null , num );
         }
        
     }
}

Week 4 Individual Assignment/src/Program/NumberGenerator1.java

Week 4 Individual Assignment/src/Program/NumberGenerator1.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package   Program ;

import  javax . swing . JOptionPane ;

/**
 *
 *  @author  Dk Dukes
 */
public   class   NumberGenerator1   {
     public   static   void  main ( String  args [])
     {
         int  num = 0 ;
         int  i = 0 ;
         while ( i < 10 )
         {
            num ++ ;
            i ++ ;
             JOptionPane . showMessageDialog ( null , num );
         }
     }
}

Week 4 Individual Assignment/src/Program/SalesCommission.java

Week 4 Individual Assignment/src/Program/SalesCommission.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package   Program ;

import  javax . swing . JOptionPane ;

/**
 *
 *  @author  orengejames
 */
public   class   SalesCommission   {
     private   int  fixedSalary ;
     private   double  commission ;
     public   int  sales ;
     private   double  salesTarget ;
     private   double  acceleration ;
     public   SalesCommission ()
     {
        
     }
     public   SalesCommission ( int  fixed , double  comm )
     {
        fixedSalary = fixed ;
        commission = comm ;
     }
     public   void  setFixedSalary ( int  fix )
     {
       fixedSalary = fix ;  
     }
     public   void  setCommission ( double  com )
     {
        commission = com ;
     }
     public   void  setSalesTarget ( double  target )
     {
        salesTarget = target ;
     }
     public   void  setAcceleration ( double  accelerate )
     {
        acceleration = accelerate ;
     }
     public   int  getFixedSalary ()
     {
         return  fixedSalary ;
     }
     public   double  getCommission ()
     {
         return  commission ;
     }
     public   double  getSalesTarget ()
     {
         return  salesTarget ;
     }
     public   double  getAcceleration ()
     {
         return  acceleration ;
     }
}

Week 4 Individual Assignment/test/com/toy/anagrams/lib/WordLibraryTest.java

Week 4 Individual Assignment/test/com/toy/anagrams/lib/WordLibraryTest.java

/*
 * Copyright (c) 2010, Oracle.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 *  * Neither the name of Oracle nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/* Anagram Game Application */

package  com . toy . anagrams . lib ;

import  java . util . Arrays ;
import  junit . framework . TestCase ;

/**
 * Test of the functionality of { @link  WordLibrary}.
 */
public   class   WordLibraryTest   extends   TestCase   {
     WordLibrary  wordLibrary ;

     public   WordLibraryTest ( String  testName )   {
         super ( testName );
     }

     protected   void  setUp ()   throws   Exception   {
        wordLibrary  =   WordLibrary . getDefault ();
     }
    
    

     /**
     * Test of { @link  WordLibrary#isCorrect}.
     */
     public   void  testIsCorrect ()   {
         for   ( int  i  =   0 ;  i  <  wordLibrary . getSize ();  i ++ )   {
             String  clearWord  =  wordLibrary . getWord ( i );
             String  scrambledWord  =  wordLibrary . getScrambledWord ( i );
            assertTrue ( "Scrambled word \""   +  scrambledWord  +
                        "\" at index: "   +  i  +
                        " does not represent the word \""   +  clearWord  +   "\"" ,
                       isAnagram ( clearWord ,  scrambledWord ));
         }
     }

     /**
     * Tests whether given anagram represents the word.
     *  @param  clearWord The word in clear text
     *  @param  scrambledWord Scrambled version of the word
     *  @return  true if the scrambledWord is correct anagram of clearWord
     */
     private   boolean  isAnagram ( String  clearWord ,   String  scrambledWord )   {
         char []  clearArray  =  clearWord . toCharArray ();
         char []  scrambledArray  =  scrambledWord . toCharArray ();
         Arrays . sort ( clearArray );
         Arrays . sort ( scrambledArray );
         return   Arrays . equals ( clearArray ,  scrambledArray );
     }

}