CS homework help? (Java)

LuDaCriS66

Platinum Member
Nov 21, 2001
2,057
0
0
I just need to make a pie chart basically.. and by using the
"Arc2D.Double" method..

let's say the first slice in the Pie Chart is 50%.. which means the starting angle and ending angle can be 0 and 180 right.. how do I make it so that the next piece has the right coordinates to start off where the last piece left off? Meaning.. so that the pieces are connected to each other..


 

ScottyB

Diamond Member
Jan 28, 2002
6,677
1
0
just make a variable to add to the beginning and to end corrdintents each time, sort of like counters.

so:

varAdd = 0;



Then if you have your first pie as 175;



begCoor = 0 + varAdd ;
endCoor = 175+ varAdd;

varAdd = 175;

Then if your next pie is 64;

begCoor = 0 + varAdd ;
endCoor = 64 + varAdd;

 

LuDaCriS66

Platinum Member
Nov 21, 2001
2,057
0
0
sweet.. thanks. I figured I should use some kind of "counter" variable but wasn't quite sure how..

now I wonder if my prof's gonna want us to add the inquiry methods for those variables
 

lukatmyshu

Senior member
Aug 22, 2001
483
1
0
Well normally you don't have to generate get and set methods for variables that don't need them .... but here I can kind of imagine them wanting one. WEll maybe not set, but definitely get (so that you can get the current angle offset ...)
 

LuDaCriS66

Platinum Member
Nov 21, 2001
2,057
0
0
Originally posted by: lukatmyshu
Well normally you don't have to generate get and set methods for variables that don't need them .... but here I can kind of imagine them wanting one. WEll maybe not set, but definitely get (so that you can get the current angle offset ...)

Yeah.. its just that our prof has told us to put in the inquiry methods on each assignment.... but this being a graphics assignment, I wasn't sure.. but I guess I might as well.. better not lose any marks for it :D