Can use help with PERL scripting in Linux/UNIX please: Write a script called act
ID: 3798652 • Letter: C
Question
Can use help with PERL scripting in Linux/UNIX please:
Write a script called activity6.2-3.pl that prompts the user 4 times:
the first time for the student’s name, and the next 3 times for the scores in quiz1, quiz2, and quiz3 respectively. The script will then compute the average.
Set the number of quizzes to 3 using the constant pragma.
The output of your script should look like below:
Purpose: Computing Quizzes Average
Name Quiz1 Quiz2 Quiz3 Average Jon Doe 12 14 15 13.66
Don’t forget to include the header information
Explanation / Answer
use constant QUIZZES => 3;
$average = 0;
$count = 0;
$name = '';
print "Purpose: Computing Quizzes Average ";
print "Name : ";
$name = <STDIN>;
for ($i = 1; $i <= QUIZZES; $i++) {
print "Quiz-$i : ";
$quizMarks = <STDIN>;
$average = $average + $quizMarks;
$count = $count + 1;
}
$average = $average / $count;
print "Average : $average ";
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.