Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Complex Spreadsheet Problems3/18/2009Opening Discussion●Minute Essay comments–How do we get Excel into Greenfoot?●Export to CSV and put it in the directory of the scenario. If you put it someplace else it will be hard to find in Greenfoot.–Math functions in Java.–Using double vs. int.–Greenfoot spreadsheet vs. Excel spreadsheet.Loops: for vs. while●Technically the for-loop and while loop can do the exact same things.–for(A; B; C) {●D–}●Same as:–A–while(B) {●D●C–}Complex Spreadsheet Functions●I have two examples that I want us to play with.–Calculating the value of money spent on a large project in adjusted dollars.–Averages for specific situations. For example you want to know how the company performed in months when certain subunits performed above or below certain levels.●We should step through how to solve each of these first. What would you need to do to solve either on Excel?More Files●We can make our program a little more useful by doing two things. –I'd like to be able to specify the file name I want to read.–I'd like to have the ability to write our table back out to a CSV file.Writing Files●To write to a file we will use a java.io.PrintWriter. Like with the Scanner, we make a new PrintWriter and give it a File object. This time it is the file it should write to.●We can then call print or println on the PrintWriter object.●We should call the close() method when we are done.Minute Essay●Do you have any questions?●What type of problems do you think we should work on next week?●Remember we do interclass problems next
View Full Document