Home‎ > ‎

Runnable FR Code

Disclaimers: The Runnable Code will try to indicate if a solution is correct or not.  It also tries to determine if a student is completing a problem in a way that does not follow the directions (by not calling a required method, for example).  In reality, this is impossible to do perfectly, but I give it my best effort.  If you can think of ways to improve my Runnable Code, please let me know!

 Directions Runnable Code Prereq Knowledge Key Part(s) of Problem
 Word List (2004) Runnable Code ArrayLists
 Strings
  • Loop over a list of String's and determine how many have a given length
  • Loop over a list of String's and remove all that have a given length
 Pets (2004) Runnable Code ArrayLists
 Inheritance
  • Write a class that extends an abstract class
  • Write a class that extends a concrete class
  • Finish a method that loops over a list of Pets and prints out information about the Pets
 Robot (2004) Runnable Code  Arrays of Ints
  • Determine whether the next position (to the left or right) in an array is in bounds or not
  • Modify an array and instance variables based on the value at the current position and the result of calling the method from the first part
  • Repeatedly call a given method (without implementation) and the method given in part 2 to complete an algorithm for processing an array
 Student Record (2005) Runnable Code Arrays of Ints
  • Find the average of a subsection of an int array
  • Determine if an array is non-decreasing
  • Call the two previous method to calculate an average based on a rule
 Hotel (2005) Runnable Code Arrays of Reservations
 ArrayLists
  • Find the first available spot (null) in an array of Resverations, creating a Reservation object to place in the array, and returning that reservation.  If no spots are found, a name is added to the end of a Wait List
  • Cancel a specified reservation in the array and replace it with a new reservation from the Wait List (generated by calling the method from the first part) or with null
 Ticket (2005) Runnable Code Inheritance
 Abstract Classes
  • Write a subclass of an abstract class
  • Write a subclass of a concrete class that needs to use super in a constructor and an overriden method.
 Vehicle (2006) Runnable Code Inheritance
 Abstract Classes
 Interfaces
  • Finish the method of an abstract class that calls an abstract method
  • Write a subclass of an abstract class
 Daily Schedule (2006) Runnable Code ArrayLists
  • Finish a method that needs to call an instance method to get a reference to an object from which one of that object's instance methods can be called
  • Finish a method that removes Objects from a list that have a certain property (needs to call the method from the first part)
  • Finish a method that adds an Object to a list if it meets a certain property, and removes Objects from the same list that conflict with it (needs to call the method from the second part)
 Customer (2006) Runnable Code Arrays of Customers
  • Finish a method that compares objects by their String name first, and then by their id (values that have to be retrieved through instance methods, not instance variables)
  • Finish a method that partially merges two arrays of Customers into one array
 AP Score (2007) Runnable Code ArrayList
  • Finish a method that calculates a score based on the String values in two lists
  • Finish a method that determines the name of the StudentAnswerSheet with the highest score (needs to use the method from the first part)
 Self Divisors (2007) Runnable Code Array of Ints
  • Finish a method that determines if all the digits of a number divide that number
  • Finish a method that creates an array of ints that meet the property from the first part (need to call that method!)
 Player 2007 Runnable Code  ArrayLists
 Inheritance
  • Write a subclass with a constructor that interacts correctly with the superclass and override one method that makes a random select based on the result of calling another method
  • Finish a method that calls a lot of given methods to simulate an abstract game
 Flight (2008) Runnable Code ArrayLists
  • Write a method that determines a value by calling a series of methods off of nested Objects
  • Write a method that determines a value in a way similar to the first part, but in this case you need to find the minimum of such numbers
 Master String (2008) Runnable Code ArrayLists
 Strings
  • Extract parts of a master string and concat them together
  • Create a list containing information of where to find parts of a String within a master String
 Checker (2008) Runnable Code Interfaces
 Strings
  • Write a class that implements an interface to check if a String is inside another
  • Write a class that implements an interface that determines whether two instances of that interface accept a value
  • Write a line of code that creates a nested object
 Filter (2008 - AB) Runnable Code Interfaces
 Arrays of Filters
  • Write a class that implements an interface that determines whether two instances of that interface accept a value
  • Finish a method that accepts an array of acceptable Strings and one unacceptable String - build a composite object made of Filters that represent this property
 NumberCube (2009) Runnable Code Arrays of Ints
  • Create an int array and fill it with values generated from an Object
  • Find the position of the start of the longest run of consecutive matching values
 Battery Charger (2009) Runnable Code  Arrays of Ints 
  • Determine a sum in a 1D array that wraps around the array
  • Determine the starting position of the smallest sum of consecutive values of a given length, wrapping allowed (needs to call the method from the first part)
 Tile Game (2009) Runnable Code ArrayLists
  • Determine the correct spot to insert an Object in a list based on a property
  • Use the method from the first part to determine if there is an insertion spot after modifying the Object
 Cookie Order (2010)  Runnable Code ArrayLists
  •  Loop over a List of CookieOrder's to sum up the total number of boxes purchased 
  •  Search through a List of CookieOrder's to find values to remove that match a given name (String)
 APLine (2010) Runnable Code Classes
  • Write a class that represents a line (instance variables, constructor, method that needs to avoid integer division, and a simple method that returns a boolean value based on parameters and instance variables)
 Trail (2010) Runnable Code Arrays of Ints 
  • Determine if a subregion of a 1D array of ints has values that differ by no more than 10
  • Determine if there are 3 or more differences in a 1D array of consecutive values that exceed 30
 Sound (2011) Runnable Code Arrays of Ints
  • Finish a method that changes all values in an array that are above or below a limit value to be at the limit value
  • Finish a method that reassigns an array instance variable to a new array with leading 0's removed from the original array
 Route Cipher (2011) Runnable Code 2D Arrays
 Strings
  • Write a methods that places substrings of length one from a String into a 2D array
  • Write a method that repeatedly calls the method from part (a) and another given method to perform an operation on a String
 Fuel Depot (2011) Runnable Code Interface
 Lists
  • Write a method that finds the position of FuelTank in a list has the lowest amount of fuel below a given threshold
  • Write a method that moves a FuelRobot to an indicated position by changing direction and moving
 Horse Barn (2012) Runnable Code Interface
 Array of Horses
  • Search through an array of Horses for one with the correct name (some could be null!)
  • Move non-null values in an array of Horses to the front without changing order
 Gray Image (2012)  Runnable Code 2D Arrays
  • Determine if a 2D array of int values contains a certain property
  • Change the values in a 2D array of ints following a given rule
 ClimbingClub (2012) Runnable Code Lists
  • Finish a method that creates an Object and adds it to the end of a list
  • Finish a method that creates an Object and inserts it into the correct position of a list
  • Answer two Yes/No questions about the correctness of an algorithm
 Download Info (2013) Runnable Code ArrayLists
  • Search through a List of DownloadInfo's to find the one that matches a given name (String) - could return null
  •  Loop over a List of song names, then call a given method to access the DownloadInfo object with that name (could be null), and either call a given method to increase the play count, or create a new DownloadInfo and add it to the end of the list of DownloadInfo objects
 Sky View (2013) Runnable Code 2D Arrays
  • Complete a constructor that initializes a 2D array of doubles from a 1D array of doubles following a pattern
  • Finish a method that calculates the average of values in a subregion of a 2D array of doubles
 Token Pass (2013) Runnable Code Classes
 Arrays of Ints
  • Finish a constructor that initializes an array with random values
  • Finish a method that takes a value in the array and distributes that value to other spots in the array (requires array wrapping)
 Scramble Word (2014) Runnable Code Strings
 ArrayList
  • Finish a method that manipulates a String
  • Finish a method that manipulates a list of Strings by calling the method from part (a) and checking for equality (remove() and/or set() may be needed)
 Seating Chart (2014) Runnable Code ArrayList
 2D Arrays 
  • Finish a constructor that initializes a 2D array of Student objects by taking values from a List of Student's and placing them in the 2D array in column-major order
  • Finish a method that replaces Student's who have too many absences with null, returning the number of students removed (beware of locations that are already null!).
 Trio (2014) Runnable Code Inheritance
 Interfaces
  •  Write a class that implements an interface

Comments