Please note: This "inclass" assignment is due before midnight on Wednesday, February 3, 2010. All future ICAs will be due before the end of class.
For this first ICA, you will write a short Perl script demonstrating several of the topics we covered in class today, including scalars, lists, arrays, hashes, join/split, and input/output.
Please use your SSH client (SecureCRT comes on all RPI laptops) to connect to rcs-sun4.rpi.edu.
Once connected, begin editing a new file, for example by typing pico ica_0.pl at the command line.
Please do not write your program in Windows and then transfer
it to RCS. Do all your work in Unix.
Once in the editor, create a Perl program which does the following:
- Prompt the user to enter a list of 3 names, separated by commas.
- Read in this string, and convert it to a list stored in an array
@names. - Declare a hash variable
%grade_of. - Prompt the user three times, each time asking for the grade of the next name. Specifically include the name you are asking for in your prompt.
- Read in each grade, and store it in the appropriate position in the hash.
- Prompt the user for one of the names, displaying all three names again, separated by a comma-and-space.
- Print out a status message identifying that person's name and grade.
Sample Execution
Here's a sample run of your program. Bold is what your program outputs, normal is what you type.
Please enter 3 names, separated by commas: John,Paul,Ringo Please enter the grade for John: 80 Please enter the grade for Paul: 100 Please enter the grade for Ringo: 95 Please enter one of the three names (John, Paul, Ringo): Paul The grade for Paul is 100
Submission Instructions
While on rcs-sun4.rpi.edu, execute the program
~lallip/public/submit.pl. Follow the prompts. You will
need the password you created via the Signup page.
You should receive a confirmation email after submitting.
You may submit your assignment infinite times. Only the last submission will be graded. Final submission is due at 11:59:59pm, Wednesday, February 3, 2010.
