## Assignments

With any of these assignments, click on the Clone button to use it in your class.

## Programming Problems

### Printing Simple Shapes

• Draw a filled triangle
• Draw a staircase
• Draw a parallelogram
• Draw picture with a tree and bush
• Print lines of a Frost poem
• Print Peter Piper poem
• Print an equation
• Print a multiplication table
• ### Numbers and Strings

• Compute rectangle area from given width and height constants
• Compute rectangle area from inputs
• Determine length of line segment
• Print out last n characters of a string
• Select and print substrings from string
• Compute future value of CD
• CD future values for different periods
• Normalize angles
• Print initials from names
• Convert Farhenheit to Celsius and Kelvin
• Initials
• Timer
• Decimal Degrees
• Degree, Minute, Second
• Distance between two points on earth
• Swap first and last name
• Change Firstname Lastname to Lastname, Firstname
• ### Branches

• Find larger of two integers
• Convert between Farhenheit and Celsius
• Put two words in lexicographic order
• Find smallest of three integers
• Determine letter grade from class average
• Determine correct quadrant for angle
• Determine worth of a pile of coins
• Update current bank balance
• Convert dollars and cents to nearest dime
• Employee Pay with Overtime
• Middle Letter
• Overlapping sets
• Intersecting Lines
• Sort Names
• Number guessing game
• All the same
• All different
• All the same sign
• ### Loops

• Find all vowels in string
• Sum of odd integers
• Count number of vowels in string
• Count words in a sentence
• Count number of 7s in number
• Raise x to the nth power
• Compute n factorial (n!)
• Reverse characters in a string
• Find palindromes
• Average characters per word
• EvenSum
• Stutter
• Count perfect squares
• Format Phone Number
• Color codes for double-sized image
• Run-Length Encoding
• ### Static Methods

• Get initials from name
• 371te hax0rs
• Determine pay for week
• Check inputs for quizzes
• Convert military time to AM/PM
• Get the middle char(s) of a string
• Determine n! recursively
• Draw rectangle []
• Count how many digits equal 7
• Area of triangle
• Combine numbers with given operator
• Number of binary digits in n
• Swap values by using an array
• Count the number of times a character appears in a string
• ### Arrays and Array Lists

• Find the sum of array elements
• Find average price in array
• Find middle element(s) of array
• Linear search
• Count occurrences of given int in array
• Find larger sum of 2D array rows
• Compute test averages from 2 1D arrays
• Count test averages below 70 with 2D array
• Copy array in reverse order to ArrayList
• Copy array to ArrayList, excluding duplicates
• List of numbers
• Short words
• Select a short word
• Diagonals on board
• Border on board
• Run lengths
• Same beginning and end sequence
• Remove short words
• Number of even and odd elements
• Letter frequency (count)
• Letter frequency (percentage)
• Swap first and second half of array
• Swap adjacent elements in array
• Railfence cypher
• ### Implementing Classes

• BankAccount with Service Charge
• BankAccount with Transaction Count
• BankAccount with Bonus for Opening Account
• ClassSchedule
• ClassSchedule with setDays and set times
• ClassSchedule with getDays and set times
• XML Map Labels
• XML Map Labels convert to decimal degrees
• Fill diagonals of square board with asterisks
• Sentence class
• Rectangle/Square: 2 constructors; 2 methods
• Count vowels, consonants, and compute their ratio in a Sentence class
• Add static variable and method to Coin class
• Rental Cars with static methods for counting rented and available cars
• Spinning disk device with getSegmentLength method
• Spinning disk device with getTransitions method
• Spinning disk device with getSegmentLength method
• A Square that can grow
• Box class with volume and surface area methods
• Reimplement Person class to increase cohesion
• Preconditions for Sentence constructor
• Static field to count number of objects
• Reimplement Vehicle class to increase cohesion
• Introduce class to implement method that mutates value
• Preconditions for SalaryBonus constructor
• Static field to maintain the total value of Coin objects created
• ### Interfaces

• Make Sentence implement Measurable
• Make a measurer for words
• Implement the Doublable interface
• Provide a RectangleDoubler class that implements the Doubler interface
• Clicking the button moves the rectangle
• Implement an Interface to Change Rectangle Dimensions
• Implement an Interface to Provide Museum's Car Count
• Using Anonymous Objects
• Creating the Movement Interface
• Using instanceof for Converting Between Animal Types
• ### Inheritance

• Extend ASCII art rectangle to filled rectangle
• Extend ASCII art rectangle to tiled rectangle
• Implement LabeledPoint.toString
• Implement LabeledPoint.equals
• Implement Tile.translate
• Auto extending Vehicle and overriding getID
• Inherit and call a superclass constructor
• An enum type describing chemical elements
• Using an Abstract Class
• Overriding the equals Method
• Write the constructor for the SavingsAccount subclass
• State quarter subclass of coin class
• Provide common shape superclass
• ### Input and Output

• Reversing the lines in a file
• Find longest word in file
• Processing exam scores
• Processing names
• Converting temperatures
• Count number words per line in file
• Replace vowels with underscores in file
• Find integers in a file
• Read file with arithmetic expressions
• Check arithmetic expression string for exceptions
• SuperCaesar Cipher
• HyperCaesar cipher
• Swap As and Os in RandomAccessFile
• Swap adjacent characters in a RandomAccessFile
• Reading a serialized array of objects
• ### Exception Handling

• Bank account constructor with IllegalArgumentException
• Catching a NumberFormatException
• Throw IllegalArgumentException in Vehicle constructor
• Design IllegalNumberOfWheels Exception
• ### Recursion

• Pyramid volume
• Zipper words
• Zipper words with helper method
• ZipperWordGenerator
• A recursive squid (square in diamond)
• Reverse an integer
• Reverse an integer with helper method
• Recursive toString for array
• Reverse toString for array
• Extract uppercase letters from string
• Recursive string reversal with helper method
• Find vowels in string with recursive helper method
• ### Sorting and Searching

• Modified SelectionSort
• Count visits in selection sort
• Count visits in selection sort
• Sort real data
• Number guesser
• Selection sort modification placing only min and max
• Selection sort modification placing even before odd
• Merge sort modification placing even before odd
• Descending merge sort
• Selection sort modification, placing the largest element first

• Linked list with all but the first two removed
• Create linked list with three strings
• Create linked list with three strings (2)
• Remove short words
• Duplicate short words
• Concatenate elements backwards
• Rotate linked list by manipulating nodes
• Remove all but first two elements from linked list
• Add an element to the front and back of a linked list
• Add an element after the first and before the last
• Implement addLast using raw nodes
• ### Stacks and Queues

• Adding and removing queue elements
• Working with queues and stacks
• Working with queues and stacks (2)
• Using a stack for checking balanced parentheses
• Palindrome testing with stack and queue
• ### Sets and Maps

• Sets of words
• Map from strings to number of letters
• Hash set of people
• Tree set of people
• Letter set
• Letter frequency map
• Path lengths in binary tree
• Hash code for LabeledPoint
• A fast priority queue
• Unique words in two string sets
• Map words to their lengths
• Map word lengths to words
• Hash code for Person class
• Make Person class comparable
• ### Generic Classes

• Generic matrix class as array of arrays
• Generic matrix class as linear array
• Generic matrix class as a map with integer keys
• Generic matrix class as a map with integer pair keys
• Pair class with compareTo method
• Generic pair with min method
• Generic method for filling an array
• Generic replicate method
• Finding the first match for a predicate
• Finding all matches for a predicate