Urgenthomework logo
UrgentHomeWork
Live chat

Loading..

Temperature Converter Program

  64 Download     📄   4 Pages / 950 Words

Temperature Converter Program

Functional Specification

1.0 General Requirements

1.1 This application program will be called Temperature Converter which will allow user to convert temperature from one of the three units to another unit.

1.2 The temperature converter program will be text based. There will not be any GUI screen.

1.3 Java programming language will be used in developing this application program and it will run on the Windows Command Prompt or on the Terminal under macOS.

1.4 The source will be named tempconvt.java. and the class file will be named tempconvt.class.

1.5 User will run this program by typing java tempconvt at the command prompt or terminal prompt.

2.0 User Interface

2.1 Welcome Screen:

  1. When the program is run it will first clear the screen and then display two lines of text about the program which is referred to here as the welcome screen.
  2. The welcome screen will look like the following:

********************** Temperature Converter ***********************

** Conversion between Celsius (C), Fahrenheit (F), and Kelvin (K) **

  1. There will be four blank lines from the top of the screen before the above is displayed.
  2. There will be two blank lines after the above is displayed before anything else is displayed one the screen.

2.2 Input Prompt

  1. User will be prompted to enter temperature type (Celsius, Fahrenheit, or Kelvin) to convert from.
  2. The prompt (two lines) for the above will be as follows:

Convert from (C, F, or K):

Note that there are two spaces at the beginning of the first line and five spaces at the beginning of the second line along with one space at the end of the second line of the prompt.

  1. User will be prompted to enter temperature type (Celsius, Fahrenheit, or Kelvin) to convert to. The prompt will be as follows:

to (C, F, or K):

Note that there are two spaces at the beginning of the prompt and one space after the prompt.

  1. At the above prompts the user will enter a letter to denote the temperature type.
  2. The above will be followed by the prompt for the value of the to be converted. The prompt will be as follows:

Enter Temperature:

Note that there are two spaces at the beginning of the prompt and one space after the prompt.

2.3 Displaying the Output

  1. After the user enters the temperature value to convert the result of the conversion will be displayed as a line of text.
  2. The result of the conversion will precede one blank line and will also follow one blank line.
  3. Temperature values will be displayed as floating point number.
  • Input Validation
  • Temperature value entered below absolute zero (-273.15 degree Celsius, -459.67 degree Fahrenheit, or 0-degree Kelvin) will be considered invalid.
  • When the user enters a temperature below -273.15 degrees Celsius the following error message will be displayed: “Invalid Celsius temperature, enter above or equal -273.15.”.
  • When the user enters a temperature below -459.67 degrees Fahrenheit the following error message will be displayed: “Invalid Fahrenheit temperature, enter above or equal -459.67.”.
  • When the user enters a temperature below 0-degree Kelvin the following error message will be displayed: “Invalid Kelvin temperature, enter above or equal 0.”.
  • Valid input at the “convert from temperature type” prompt (Requirement No. 2.2b) are characters C, F, or K. When the user enters an invalid value the following message will be displayed and the user will be prompted again until a valid value is entered.

Invalid Temperature Type is entered. Enter C, F, or K.

Note that there are two spaces at the beginning of the above message.

  • Valid input at the “convert to temperature type” prompt (Requirement No. 2.2c) are characters C, F, or K. When the user enters an invalid value the following message will be displayed and the user will be prompted again until a valid value is entered.

Invalid Temperature Type is entered. Enter C, F, or K.

Page 2 of 3

Note that there are two spaces at the beginning of the above message.

  • The user will be able to enter upper or lower case letters for entering the temperature type. This means C, c, F, f, K, and k are all valid entries.
  • Output Formatting
  • The line of text showing the result will be formatted as follows: The input temperature value will be concatenated with the text “degrees” followed by the input temperature unit which will then be followed by the text “is equal to”. This will be followed by resulted temperature and the text “degrees” followed by the temperature unit resulted temperature. Here is an example:

0.00 degrees Fahrenheit is equal to 255.37 degrees Kelvin.

Note that there are two spaces at the output text.

4.2 All temperature values will be rounded two places after decimal when displaying as an output. It will not be rounded during the calculation.

  • Computations
  • The relations between various units of temperature are as follows:

Kelvin to Celsius: C = K - 273.15

Kelvin to Fahrenheit: F = 1.8(K - 273) + 32

Celsius to Fahrenheit: F = 1.80(C) + 32

Celsius to Kelvin: K = C + 273.15

Fahrenheit to Celsius: C = (F - 32)/1.80

Fahrenheit to Kelvin: K = 5/9(F - 32) + 273.15

  • It will be assumed that temperature below the absolute zero is not a valid temperature and hence will not be processed.
  • Other Requirements
  • When a fatal error occurs during the conversion where there is no way to recover from it the program should gracefully exit with an error message. Under no circumstances the program should crash.
  • After the result is displayed the program will wait on the user to hit the Enter key upon which the program will exit.
  • The above prompt will look like the following:

Resources

  • 24 x 7 Availability.
  • Trained and Certified Experts.
  • Deadline Guaranteed.
  • Plagiarism Free.
  • Privacy Guaranteed.
  • Free download.
  • Online help for all project.
  • Homework Help Services
Copyright © 2009-2023 UrgentHomework.com, All right reserved.