Explore BrainMass
Share

Explore BrainMass

    Write a Program in Perl to Validate Input Temperature

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    1. Physicists tell us that the lowest possible temperature is absolute zero. Absolute zero is -459.69 degrees Fahrenheit.

    a. Accept inputs from the user: a beginning temperature, an ending temperature, and an increment value (all Fahrenheit).

    b. Check for bad input: a temperature less than absolute zero and an ending temperature less than a beginning temperature. The program will send a message to STDERR if either condition is detected.

    © BrainMass Inc. brainmass.com October 9, 2019, 6:26 pm ad1c9bdddf
    https://brainmass.com/computer-science/perl/write-program-perl-validate-input-temperature-88357

    Solution Preview

    Following is the Temperature program.
    chomp simply removes the newline character from the string.
    The first if statement checks if $end is less than $beg and the second if statement checks
    if either of them is less than the Absolute Zero temperature.
    Remember, we are dealing with negative numbers and -1 is greater than -2!
    Also, ...

    Solution Summary

    The solution is a working PERL code.

    $2.19