Changes between Version 9 and Version 10 of ProgrammingPrompts


Ignore:
Timestamp:
Nov 23, 2015, 7:31:31 PM (9 years ago)
Author:
Timothy Lin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ProgrammingPrompts

    v9 v10  
    11= Programming Prompts
    2 Feel to add good prompts into this list as you find them. This will greatly help future software team leads and new programmers.
    3 
    42The 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.
    53
     
    97}}}
    108
    11 '''Checkerboard'''[[BR]]
     9[[BR]]
     10{{{
     11#!div style="border:1pt dotted;color:red"
     12Note: While the prompts are in beta phase, the starter code is not yet available for most of the prompts.
     13}}}
     14
     15=== Checkerboard
    1216Write 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]][[Image(https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Checkerboard_pattern.svg/300px-Checkerboard_pattern.svg.png)]]
    1317
     18=== Sort3
     19Use 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.
     20
     21Best results if you think about the code yourself, and not look it up.
     22
     23=== !MovingAverage
     24A 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:
     25
     26'''public class !MovingAverage'''
     27==== !MovingAverage(int n)
     28Constructor. Takes a parameter {{{n}}} that determines how many of the recent values to average.
     29==== void addValue(double)
     30Adds a value to the list. Does not directly change the average. The average should be updated immediately to reflect this addition.
     31==== double getAverage()
     32Returns the moving average of the most ''recent'' {{{n}}} values entered.
     33==== void clear()
     34Clears the list. getAverage() should now return 0.
     35
     36=== !RomanNumeralInterpreter
     37Write 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]).
     38
     39=== !QueenCheck
     40Given 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}}}.
     41
     42''Remember, queens threaten other chess pieces when they lie on the same row, column, or diagonal.''
     43
     44=== !CodeBreaker
     45You 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.
     46
    1447== Test Scripts
     48You can download the ''Eclipse'' projects individually for each prompt, or download them all in a single zipped file (separate projects).