Results 1 to 2 of 2
- 03-09-2011, 08:56 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
Need help with displaying println for Methods
I'm doing a stub'd version of the Towers of Hanoi - quite new to this and my professor did not pick a good book to teach with so the assignments got a bit mixed up. I've got methods in place for every circle I need and then I've called each of the methods. I've labeled them by peg, green circle, yellow circle and blue circle.
I've set their coordinates to be 100 px apart on the window. There is a peg, and all three disks for each set of coordinates so that they would be overlapping. There is no graphical circles, just a system.out.println("..."); that is supposed to display where each of the pegs and circles are supposed to be located. It's all technically valid, but nothing is appearing on my window. Here's part of what I've got:
class Circle {
int centerX, centerY, radius;
Color fill;
public Circle() {
centerX = 0;
centerY = 0;
radius = 0;
fill = null;
}
public int X(){return centerX;}
public int Y(){return centerY;}
public int Radius(){return radius;}
public Color Fill(){return fill;}
void pegCircle50(){
System.out.println("Drawing circle at: (" +
centerX + ", " + centerY + ") with radius: " +
radius + " and color: " + fill);
}
}
Circle pegCircle50(int centerX, int centerY, int radius, Color fill) {
centerX = 50;
centerY = 50;
radius = 10;
fill = Color.getHSBColor(20, 240, 60);
return pegCircle50(centerX, centerY, radius, fill);
}
- 03-09-2011, 09:10 PM #2
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
modified, but still not working
I added: int centerX, int centerY, int radius, Color fill into the code that is supposed to print the method with the specific parameters:
void pegCircle50(int centerX, int centerY, int radius, Color fill){
System.out.println("Drawing circle at: (" +
centerX + ", " + centerY + ") with radius: " +
radius + " and color: " + fill);
}
still not working tho... I'll keep plugging away as this was due yesterday :confused:
Similar Threads
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
Displaying println output on GUI
By SCCY in forum AWT / SwingReplies: 1Last Post: 08-09-2010, 01:34 PM -
Println VS system.out.println
By ccie007 in forum New To JavaReplies: 2Last Post: 05-20-2010, 08:52 AM -
Need help with println
By jhetfield18 in forum New To JavaReplies: 8Last Post: 09-18-2009, 08:26 AM -
difference between system.out.println() & out.println()
By wickedrahul9 in forum Advanced JavaReplies: 5Last Post: 10-18-2008, 11:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks