image provider

Beginner’s Projects


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, 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 in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

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 (Graphic User Interface) 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 serialization. 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

This page is posted
on the web at:

http://mindprod.com/project/beginner.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\beginner.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.145.108.9]
You are visitor number