Important: As noted in the General Information handout, we will not be accepting any late submissions for this assignment, even if you have late days remaining.
Your sixth assignment is a baby name graphing program that will give you practice with data structures, classes and interactors.
Getting Started
There is a starter project including all of these problems that you can access using the link below. Once you have the starter code set up, edit the program files so that the assignment actually does what it’s supposed to do (see the assignment handout), which will involve a cycle of coding, testing, and debugging until everything works. The final step is to submit your assignment.
This assignment may (optionally) be done in pairs. As a reminder, you may only pair up with others with the same section time and location.
Assignment Files
To run the demo, download the zip file below and unzip, and double-click the enclosed JAR file to run. If you are unable to run it by double-clicking, right-click on the demo JAR file and click "Open".
Output Files
If you would like to view them separately, the output image files, which are already included in the starter code in the output
folder, are listed below as well. For more example output, please see the demo program, linked above. In the demo, you can go to File->Save and save images of the graph to compare to.
Other Resources
Note: the "Debugging with Karel" handout still provides valuable debugging tips for Java programs! In particular, the debugger functions identically for Karel and Java programs. You can also mouse over variables while the program is paused in the debugger to view their current value (super useful for arrays!)
F.A.Q.
-
Q: I am trying to use println to debug my program, but it's not working. Why not?
-
A: You can certainly debug using print statements in this assignment (or the debugger!), and we encourage it. But not all files in this assignment are programs (some just define new variable types!), so you cannot call
println
. To get around this, instead of writing just println
, you need to write System.out.println
, and the output will appear in the "Console" tab at the bottom of your Eclipse window.
-
Q: Why is it that all of my calculations in NameSurferGraph come out with a result of 0?
-
A: This could be because you are using integer division, or you are calling getWidth() or getHeight() before the canvas has been added to the screen.
-
Q: I'm having trouble getting Eclipse to work! Help!
-
A: Please make sure you followed the instructions in our Eclipse Guide above. If you are still having trouble, please come to Nick or Rishi's office hours, or stop by the LaIR.
-
Q: Eclipse is giving me a strange message about a file being "out of sync" with the file system.
It says I can press F5 to refresh the file. What does this mean?
-
A: This happens if you edit/change your file outside of Eclipse. Just press F5 and Eclipse will show you the newest version of the file.
-
Q: I didn't like the program name, such as
Hangman
, so I renamed it to my own name such as DaveIsGreat
.
That is okay, right?
-
A: No. For grading purposes, we need you to leave the program names the way we named them.
-
Q: How do I turn in the assignment?
How do I know if my submission was successful?
-
A: Please see the Eclipse Guide link above for more information about submitting.
-
Q: Why doesn't my Java program say "[completed]" in the top status bar when it is done?
-
A: This is often because your program contains an infinite loop. Make sure all of your loops are terminating properly when your program is finished! Also see the debugging handout above for how to use the Eclipse debugger to track down and squash bugs.
-
Q: Will my solution get full credit?
Is it written in the style you want?
Will I get marked off for this code?
-
A: In general we cannot answer these kinds of questions. We call this "pre-grading." The section leader/TA/instructor can't look over your entire program for mistakes or tell you exactly what things you will get marked off for; we don't have the resources to provide such a service, and even if we did, we want you to learn how to gain these intuitions on your own. We'll grade you on the guidelines in the homework document and style guide, and we can help you with specific issues and questions about your code, but we cannot pre-evaluate your entire program for you or give you advance warning about every possible mistake or violation.