Paul Clapham wrote:I don't quite understand what it is that you want to graph, but I think that's part of your problem too. So what I'd suggest is this: Draw a fairly detailed diagram of what one of those graphs might look like, and then start figuring out what data you would need to produce that graph. Once you have done that, the next step is to modify your code to get the relevant data and store it in a suitable data structure.
I want to take the ArrayList (profitList) and graph the profit inside of it. So like, X would be the amount of carsSold. and Y would be the profit. Thinking of that now, I suppose I wouldn't need an ArrayList for this type of graph.
So then I'd take the code: for (Profit profit : profitList) {
newTotal += profit.getProfit();
That would get me the total amount of profit. Under the carSold method I'd just add soldCars = soldCars + 1; and make the soldCars variable global so I can call it under the printProfits() method or the new graphing method...if I can figure out how to graph it.
The problem is: I have no idea what code to use to graph something. It doesn't have it in my book: (Objects first with
Java)
If I can't get it to graph, then the printProfits() variable will look something like this:
I just don't think that's good enough for my final project. But it'll have to do if I can't get the graph to work. Oh well, back to google-fu and waiting for a response! (hope this clears up what I wanted)