Question: This question is for a program in Java. In the traditional English system of measurement, each inch on a ruler is marked off into fractions

This question is for a program in Java.

In the traditional English system of measurement, each inch on a ruler is marked off into fractions using tick marks that look like this:

This question is for a program in Java. In the traditional English

The longest tick mark divides the inch into halves, two shorter tick marks indicate the quarter divisions, and even shorter ones mark the eighths, sixteenths and so on. Write a recursive method drawRuler to draw this. The method is given the coordinates for a rectangle in which to draw the ruler. The method draws a sequence of vertical tick marks. The center tick mark is half the height of the rectangle in which it's drawn. Each smaller tick mark is half the height of the next larger one. Once the tick marks become sufficiently small (say 2 pixels), the recursion terminates. The idea is to recognize that the middlemost tick mark subdivides the rectangle into two smaller rectangles, each of which is a smaller ruler of its own.

Ruler Viewer Ruler Viewer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!