CMPS 13H: Honors Introduction to Programming and Data Structures

Programming Assignment #1: Temperature Conversion


Remember: your programming assignment must be turned in online.

The Basics

The goal of this assignment is to get everyone up to speed on writing simple java programs that include user input and output, basic math, and conditional statements.

The program you are to write will do conversion from fahrenheit to celsius and celsius to fahrenheit. It will ask the user which conversion to do, ask the user for a temperature, convert it to the other scale, then print out both temperatures in a nicely formatted way.


The Details

Your program must ask the user which conversion to do, celsius to fahrenheit or fahrenheit to celsius.

Then ask the user for a temperature and convert the temperature to the other units.
Conversion formulas:
fahrenheit = ((9/5)*celsius) + 32
celsius = (5/9)*(fahrenheit - 32)

Then print out the result in some nice format.

[If that was too easy] Make the program loop, repeating the above steps, with an additional choice for exiting the program.

Your program must be accompanied by a one page ASCII document (.txt format) that shows your design:

  1. Inputs
  2. Outputs
  3. Data objects and all non-trivial operations on those data objects
  4. Algorithm(s)

Your program must also contain clear and descriptive variable names and comments, and good formatting that enhances the clarity of the program.


What to turn in

Your java program (called convert.java) and your design document (called design.txt).

REMEMBER: Do not submit object files, assembler files, or executables. Every file in the submit directory that could be generated automatically by the compiler or assembler will result in a 5 point deduction from your programming assignment grade.


sbrandt@cse.ucsc.edu