COP 2800 (Java Programming) Project #2
Temperature Conversion Chart Applet

 

Due: by the start of class on the date shown on the syllabus

Description:

Using HelloWeb.java as a model create a Java applet that displays a Fahrenheit to Celsius temperature conversion table.  The table should run from 0 degrees Fahrenheit to 250 degrees Fahrenheit, in steps of 10 degrees.  Round the output to the nearest integer.

Display any temperatures below freezing (32o Fahrenheit) in blue and any temperatures above boiling (212o Fahrenheit) in red (the rest in black).  See the TempConv.java model solution on the website.

The formula to use is:

Degrees Celsius = ( 5 ÷ 9 ) × ( Degrees Fahrenheit - 32 Degrees )

Other Requirements and Grading:

You must turn in an Applet, not a stand-alone program.  You must meet all the requirements from the description above.  If you include any creative extras, be sure your program still performs the basic chart as described above.  Creative extras are extras and you are not free to modify the project requirements.

A non-working project can score quite well (so don't be afraid to turn one in).  Also a fully working project may not score 100%.

You must work alone on your project, however you can ask your instructor for help anytime.  Please see the syllabus for additional information about projects.

Hints:

If you don't know how to start crafting a program from a written problem description, How To Develop Your First Java Program may help.

Comments can be difficult for some students.  The trick is to know your audience: another Java programmer.  You therefore don't want to include comments like the following:

int i;    // declaring i as an int
i += 10;  // adding 10 to i

A Java programmer already understands the code.  Instead you should have comments that explain why you are declaring i, and why are you adding 10 to i.  You also should have some comments at the top of every file with a brief description of the file and your name.

A great way to come up with your comments is to first enter your design as a skeleton class with nothing but comments in the methods.  Later you fill in the code below each comment.

Use HelloWeb.java and MinHTML.htm (from the HelloWeb example) to start with, just change the names.  Use the statements in the paint() method of GUIGreet.java for examples of drawing lines, rectangles, and setting colors and fonts.

Use g.setColor() to change the color of the subsequent text.  (See the paint() method of GUIGreet.java for examples of this.)  To draw numbers or text, use:

g.drawString( "   " + fvalue + "   " + cvalue, col, row );

Where col and row are integer values of pixels.  Each line of text should be on a different row or else all your text will be drawn one row on top of each other, resulting in an ugly scribble.  A line a text is about 10-12 pixels tall, so rows should be about 12-15 pixels apart.

Some possibly interesting Unicode characters are "\u2103" (for " °C "), "\u2109" (for " °F "), "\u00A9" (for " © "), and "\u00B0" (for " ° ").

To be turned in:

Email to me your Java source and your HTML files, by copy-and-paste (no attachments please!).

Send projects to .  Please use a subject such as "Java Temp Conversion Project" so I can tell which emails are submitted projects.  Send project questions to .  Please use a subject such as "Java Temp Convert Project Questions" so I can tell which emails are questions about the project.

Please review Submitting Assignments and Project Grading Criteria from your class syllabus for further details.