Question: why is this not working on eclipse? it says it's missing a } but I don't see where import java.util.*; import java.lang.*; import java.util.Scanner; class
why is this not working on eclipse? it says it's missing a } but I don't see where
import java.util.*; import java.lang.*; import java.util.Scanner;
class RecRuler { public static void main(String args[]){ int max_tick=4; System.out.println("How many inches (0 - 3) :");
Scanner in = new Scanner(System.in); int num = in.nextInt(); drawRuler(num,max_tick); }
public static void drawRuler(int nInches, int ml) { drawLine(ml, 0); // draw inch 0 line and label for (int j = 1; j <= nInches; j++) { drawInterval(ml); drawLine(ml, j); } } private static void drawInterval(int cl) { if (cl >= 1) { drawInterval(cl -1); drawLine(cl); drawInterval(cl-1); } } private static void drawLine(int tl) { drawLine(tl,-1); }
private static void drawLine(int tl, int tickLabel){ for (int j = 0; j < tl; j++)
System.out.print("-");
if (tickLabel >= 0)
System.out.print(" " + tickLabel); System.out.print(" "); }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
