117 Homework Assignment #7 (5 pts)
Write 2 perl programs and call them
proj7a.pl
proj7b.pl
spec for proj7a.pl
this program should display your name 20 times.
Use a loop.
spec for proj7b.pl
This program should prompt you to enter a number.
Save the number in an array.
(Your program should only use one array.)
Use a loop to repeat this.
If the user enters -1
end the loop
and display all the numbers that have been entered.
how to get credit for this assignment:
upload your 2 programs via ftp
to unix01.sac.edu
in directory /cs117/xxx
where xxx is your 3 char login
here is an example from the dos command prompt:
proj7a.pl # run the program to make sure it works
ftp unix01.sac.edu
user # enter your 3 char login
password # enter your 5 char password
cd /cs117/xxx # where xxx is your 3 char login
put proj7a.pl
exit
If you are not sure that you did the ftp correctly,
you may email me
and I will check if your file is there.
==================================================
9-29-2007
Question: Should proj7b.pl display the -1 ?
Answer:
In general, whenever a spec is not clear, try to follow the literal
instructions as closely as possible. Imagine 100 programmers all
developing different programs that call this program. They cannot pick
and choose how they would like the spec to be. They must work with
what is given.
Exception: if the literal way is much more time consuming to implement,
ask first. In this case it is not. Since -1 was entered, you should display
it.
====================================================
Good structure for this program proj7b.pl
will be to use separate, independent code segments
for the phases of the program.
proj7b.pl has 2 phases:
1. get input from the user
2. display the array
====================================================
Good indentation is needed to quickly see the structure
of the blocks of code.
Failure to indent correctly will be a deduction.