= Programming Prompts The prompts are written with Java in mind, but can be adapted to most languages. The downloadable test scripts are run with Java, require the main class name to be the name of the prompt, and use the default package. {{{ #!div style="border:1pt dotted;color:green" Note: To use the starter code and test scripts at the '''bottom of the page''', download them to the directory of your choice, then in ''Eclipse'', right-click in the ''Project Explorer'', click ''Import...'', and in the dialog box, select ''General'' --> ''Existing Projects into Workspace''. Select the directory you saved the unzipped file into for the root directory, and select all projects there. }}} [[BR]] {{{ #!div style="border:1pt dotted;color:red" Note: While the prompts are in beta phase, the starter code is not yet available for most of the prompts. }}} === Checkerboard Write a static method that takes two int parameters {{{m}}} and {{{n}}} and returns a checkerboard-patterned two-dimensional boolean array that is {{{m-by-n}}} in size. Any given checkerboard square on a checkerboard has no adjacent squares with the same color (boolean value).[[BR]] {{{ #!div align="center" [[Image(https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Checkerboard_pattern.svg/300px-Checkerboard_pattern.svg.png)]] }}} === Sort3 Use only if-statements and/or nested if-statements to sort three numbers in ascending order. Do not use for-loops, or call any methods besides the ones you write. For an extra challenge, write the static method using only 3, un-nested if-statements, which is the minimum number. Best results if you think about the code yourself, and not look it up. === !MovingAverage A moving average is the average of the {{{n}}} most recent numbers. Design a data type (see the Internet for a definition) that has the following API that computes the moving average of a set of {{{n}}} numbers stored in the data type: '''public class !MovingAverage''' ==== !MovingAverage(int n) Constructor. Takes a parameter {{{n}}} that determines how many of the recent values to average. ==== void addValue(double) Adds a value to the list. Does not directly change the average. The average should be updated immediately to reflect this addition. ==== double getAverage() Returns the moving average of the most ''recent'' {{{n}}} values entered. ==== void clear() Clears the list. getAverage() should now return 0. === !RomanNumeralInterpreter Write a static method that takes a string input argument (the Roman numerals) and returns the Arabic ("normal") equivalent. Use conventional, contemporary rules for Roman numerals (see [http://en.wikipedia.org/wiki/Roman_numerals wikipedia]). === !QueenCheck Given a chess board (8-by-8) populated entirely by queens, determine if any of the queens are threatened by another. Write a static function to determine this, given a 2D boolean array where queens are represented by {{{true}}}. ''Remember, queens threaten other chess pieces when they lie on the same row, column, or diagonal.'' Your static method should return true if any queens are threatened by another and false otherwise. === !CodeBreaker You will be provided a lexicon of common words in {{{lexicon.txt}}} which is in the same directory. Write a program that takes in a Caesar-ciphered string and decrypts it reliably (> 95% success rate). You will not be given the shift key. Do not look at the ciphertext to help with the decoding; your program needs to be able to decode it without human assistance. == Test Scripts Test scripts are designed to help you debug your code, not for any grade/point value (what are grades?), so they are not secure. You can download the ''Eclipse'' projects individually for each prompt, or download them all in a single zipped file (separate projects).