So I'm really new to java programming and of course I've gotten down to the wire on an assignment and I'm stuck. I keep getting the error "plotBar cannot be resolved to a type" and I'm really clueless as to what to do I've tried many things and I'm stumped, my only other programming experience is in C programming.
Here's what I'm supposed to do:
A public method plotBar which returns nothing and takes in order these arguments: an
int for the x-coordinate of the bar's lower-left corner, an int for the y-coordinate of the bar's
lower-left corner, a double for the bar's width, and a String for the bar's text label. Suppose
this method is called with:
plotBar(10, 20, 57.5, "Vegan Republicans");
Then this method prints the text:
newpath
10 20 moveto
57.5 0 rlineto
0 BAR_HEIGHT rlineto
-57.5 0 rlineto
closepath
fill
67.5 20 moveto
(Vegan Republicans) show
This code traces the perimeter of the bar and fills it. The last two lines print the label text
starting at the lower-right corner of the bar.
Here's my code:
package hw1; public class BarPlot { public static final int BAR_HEIGHT = 20; public void plotBar(int givenX, int givenY, double givenWidth, String name){ private int x, y; double width; x = givenX; y = givenY; width = givenWidth; } }
Other than the error I was trying to figure if I'm entering the string in the method parameters correctly.
Thanks for any help you can give(and yeah its due tomorrow )