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:
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 ViewerStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started