Perl

Moderators: Jonathan
Number of threads: 1257
Number of posts: 3636

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Perl program or script Posted by princesst45 on 13 Jul 2010 at 11:17 AM
OK, we were assigned to this assignment: Physicists tell us that the lowest possibel 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 zero and an ending message to STDERR if either condition is detected. c)Print a header showing "Fahrenheit Celcius". Print all the values from the beginning to the ending temperatures. Use a loop mechanism. The conversion formula is: C =(F - 32) / 1.8

#!/usr/local/bin/perl
printf "Please enter temperature(in Fahrenheit) \n";
printf "Enter the beginning temperature \n";
chomp($beg=);
printf "Enter the ending temperature \n";
chomp ($end=);
printf "Enter the increment value \n";
chomp($inc=);

if ($end < $beg)
{
printf STDERR "Beginning temperature can not be larger than ending temperature \n";
}
if ($beg < -456.69 ||$end < -456.69)
{
printf STDERR "Temperature can not be below absolute zero \n";
}
printf "Fahrenheit Celcius" \n";

now how do I incorporate the loop for the beginning to ending temperatures to print the values is where I am stuck at
printf "$beg \n";
printf "$end \n";



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.