Search This Blog

Wednesday, December 7

Homework Assignment 1


So we are officially getting started!

You can see the official assignment at:

But here is a snippet of the assignment description & result:

Assignment 1

Description

Write a Java console program that performs temperature scale conversions between Fahrenheit and Celsius.
When your program starts, it should print out a list of menu items.
After a menu item is chosen, the program should ask the user to input a number to convert. A result is printed on screen after the number is entered. The program then prints the menu again for user input.
If the user input chooses an invalid menu item, the program will print out “Invalid Selection” message. You can assume users will always enter valid temperature values.
Formulas for temperature scale conversion can be found at: http://en.wikipedia.org/wiki/Fahrenheit

The following is an example of inputs and outputs of a running program.

***************************************************
Please choose an option for temperature conversion:
1: Fahrenheit to Celsius
2: Celsius to Fahrenheit
x: Exit
1
Please enter a number in Fahrenheit to convert: 46.4
8.0 Celsius

***************************************************
Please choose an option for temperature conversion:
1: Fahrenheit to Celsius
2: Celsius to Fahrenheit
x: Exit
2
Please enter a number in Celsius to convert: 15
59.0 Fahrenheit

***************************************************
Please choose an option for temperature conversion:
1: Fahrenheit to Celsius
2: Celsius to Fahrenheit
x: Exit
t
Invalid Selection.

***************************************************
Please choose an option for temperature conversion:
1: Fahrenheit to Celsius
2: Celsius to Fahrenheit
x: Exit
x
Exit Program.

No comments:

Post a Comment