I periodically teach an introduction to programming course using Java. I want to give my students some exciting assignments that they can relate to or find interesting. At the very least, I want assignments that make sense and have an internal cohesion (for example, some very bad programming exercises seem contrived just so that you have to use the most recent programming construct covered).
To give you an idea of scope, here's what's being covered:
- The assignments must be in Java, using some external library can be done, but it would need to be a simple API and not a full framework
- Variables, Primitives and Strings
- Console input and output
- Arithmetic and logical operators
- Simple graphics with line and shape drawing
- Static methods
- One-dimensional arrays
The students will not go into advanced topics (e.g., no recursion, no emphasis on inheritance). Thus, I'm not looking for complex projects: "Have them write a C compiler. I did it when I was 5 and it was the only way I learned!"
If you have ideas that are more advanced than the scope, please post them on the "Challenging" question linked below, and not this one.
Instead, what I'm looking for are interesting ideas that can be accomplished in a short program. For example:
Students can write a console version of the "Star Wars Name" Generator. This is effectively reading Strings and using
substring, but I think it's fun. A similar variation would be a "Mad Libs" program. I used this one five years ago, and perhaps it's already "stale."
Using some trig supplied to them, students can draw regular polygons, and create interesting spiral shapes.
It's also not out of the question to use some simple animation class with most of the code supplied to them. And if you know a Twitter or Facebook service that can be accessed with a simple API, I would be very interested to know.
Please note that this question is different from the "Challenging Java questions for beginners" Question. I'm not looking for challenging per se, just interesting. I think if students work on something where they can easily answer "why would anyone ever want to program that?" then they will learn better.
Even simple problems like computing Miles per Gallon can be good. Although, if there's a way to update it to be more relevant, all the better. If you have an exercise from somewhere else (a book or a website), please cite the source.
To help you think about the typical freshman today, check out the Beloit Mindset list, for many examples that will surely make you feel old.