Beginner’s Projects Beginner’s Projects
home Student Projects no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. It does not describe an actual complete program. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; I have too many other projects of my own.

I do contract work for a living, which could include writing a program such as this. However, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project any way you please.

These projects are simple enough to be completed in an hour or two, and are aimed at rank beginners.

Goldilocks

You enter the temperature of some porridge on the console. The program prints out too hot, too cold or just right on the console. See the file I/O Amanuensis for how to read and write the console. See the Conversion Amanuensis for how to convert Strings to ints.

This is a deceptively simple program that ensures you understand many basics.

Sieve of Eratosthenes

This is a way of finding prime numbers by crossing every second number off a list, then every 3rd, then every 5th. You can do it most efficiently with a BitSet, or you might use an array of booleans. See prime numbers.

Fortune Teller

A simple GUI with a button. When you press it, the program displays one of a number of preselected “fortunes”. See random numbers.

Sales Tax Calculator

A simple GUI. You enter an amount, and hit a button, and it display the tax and total price.

Then do a reverse tax calculator for a retailer to use. You enter the desired final price, and it calculates the selling price.

Simple Time and Billing Calculator

You enter data, perhaps using a CSV file of start time, stop time. You compute the total hours worked and multiply it by the hourly rate. Once you get that, going add features like accumulating hours by billing category. Provide a daily breakdown by billing category. Then allow breakdowns by customer. Don’t forget to deal with the problem of people working over midnight. If you want get really fancy, deal with daylight savings.

Phone Directory

Do a phone directory, email list, password list, etc. Each entry is an object in a Collection that you read/write as a whole at start up and shutdown using serialisation. Your gui lets you find objects in various ways, create, delete and update them.

In Words

See the InWords Applet. It converts numbers to their equivalent words, e.g. 123 become one hundred twenty-three in 26 different languages. Add some more languages.

Roman Numerals

Write a program to convert a long to Roman numerals. Write another to convert it back. See the InWords Applet for inspiration.

Tunings

Look at the sound entry for how you can mathematically define sound files. Western music is based on a 12 tone scale. Each note of the octave is the 12th root of 2 higher. Major and minor scales pick a set of 8 of the 12 tones.

In theory you could create scales based on any other number, particularly ones with lots of divisors. e.g. 8 or 16 or 24. I would be curious to hear some scales, even ones of a prime number like 13. I would also be curious to see what appegios, chords etc. are possible. It would be interesting to see if it is possible to transpose the music of say Bach into a new scale and see what it sounds like.

If it turns out any of these sounds are in the least pleasant, you should be able to sell them to advertisers for catching attention.

Predator Prey

This exercise teaches basic Collections and generics. Pick an ecosystem. Create a set of Species objects that contain some facts about each species such as name and average adult weight in k.g. Now accept facts about predator and prey relationship encoded with a method:
public static void eats( String predator, String prey );
There should be a method:
public static Species[] whoEats( String prey )
and there should be a method:
public static Species[] whoIsEatenBy( String predator )
and finally:
// All Species heaviest first
public static Species[] speciesByWeight()
Implement the predator->prey and prey->predator lookups with one-to-many mappings using a HashMap keyed by species name whose value is an ArrayList of Species that you maintain in sorted order by species name. When you insert, use Collections. binarySearch to find the new insertion point.

Implement speciesByWeight using a Collections. sort rather than a TreeSet. Make sure you include all species, without duplicates.

For bonus points, implement:

public staticSpecies[] whoIsIndirectlyEatenBy( String predator )
Watch out for endless recursion.

Note that I have not told you all the pieces you will need to create to solve the puzzle. I am not totally spoon feeding you in this exercise.

ArrayList
binarySearch
Comparable
HashMap
sort

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.17] Spread the Net
You are visitor number 4,515.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/project/beginner.html J:\mindprod\project\beginner.html