####################################################################### # Perl # # Type in the following program into a file called HelloPe.pl. # # $ perl HelloPe.pl ####################################################################### print"Hello World!\n"; print"Enter a number and press return:"; $num1=; print"Enter another number and press return:"; $num2=; $num1=~s/\n//; $num2=~s/\n//; $result=$num1+$num2; print"Result:$num1+$num2=$result \n"; /********************************************************************** Java - Type in the below program in a file called HelloJ.java, then type in the following commands at the unix prompt Be very careful with capitalization. $ javac HelloJ.java $ java Hello **********************************************************************/ import java.io.*; public class HelloJ{ /*class HelloJ*/ public static void main (String argv[]){ /*Starting Main*/ try{ System.out.println("Hello World"); BufferedReader in= new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a number and press return"); String num1= in.readLine(); System.out.println("Enter another number and press return"); String num2= in.readLine(); Integer Num1=Integer.valueOf(num1); Integer Num2=Integer.valueOf(num2); int val1=Num1.intValue(); int val2=Num2.intValue(); int result=val1+val2; System.out.println("Result:"+num1+" + "+num2+" + "+result); }catch(IOException e){ System.out.println("Error"); }catch(NumberFormatException nf){ System.out.println("Error"); } }//close main }//close Class HelloJ