Class Ruler

java.lang.Object
com.zybooks.dsaj.recursion.Ruler

public class Ruler extends Object
Provides support for drawing an English ruler.
  • Constructor Details

    • Ruler

      public Ruler()
  • Method Details

    • drawRuler

      public static void drawRuler(int nInches, int majorLength)
      Draws an English ruler. The level of division depends upon the designated length of the major tick. For example, a major tick of length 3 will produce a ruler with ticks (of length 2) at the half-inch mark and ticks (of length 1) at the quarter-inch marks.
      Parameters:
      nInches - the total number of inches to be drawn
      majorLength - the number of dashes used at complete inch marks
    • main

      public static void main(String[] args)
      Draws sample rulers with various parameters.