Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write programs in Perl, submit the code at blackboard. The files should be combi

ID: 3588669 • Letter: W

Question

Write programs in Perl, submit the code at blackboard. The files should be combined in a zip file and named as yourname_HW3.zip (Conduct a virus check before submitting). Due data: Monday, 16th of the October, 2017 by 11:59 AM 1. Blackboard does not accept late submission. 2. Do not share your code- code scanning will be performed by default. Write a Perl program that asks the values of the length and width of a rectangle and prints the area of the rectangle. (10 points. File name:hw3_1) 1. Write a Perl program that asks a number and prints the sum from 1 to the entered number (10 points. File name:hw3 2) 2. Ex) $ Enter a number: 10 $ The sum from 1 to 10 is 55 Write a Perl program that asks a series of words (with one word per line) until end-of-input then prints the series of words in an inverse order. (15 points. File name:hw3 3) Ex) $ Enter a series of words: 3. Good $ The result is: Good Write a Perl program that asks a series of words (with one word per line) until end-of-input, prints the above words in ASCII order, and then prints the repeated words.(15 points. File name hw3_4) Ex) S Enter a series of words: Fred 4. Betty Fred S The result is: Fred $ The repeated words: Fred

Explanation / Answer

1) print "Length of the rectangle ";
$a = <>;
print " Width of the rectangle ";
$b = <>;
print "The area of the rectangle ",$a*$b;

---------------------------------------------------------------

2)my $total;
print " Enter the last number ";
$number = <>;
for (1..n) {
$total += $_ for split "";
}
print "$total ";

.................................................................................

3)

............................................................................................

4)

# read lines of input
while(defined($line = <>)){
  
chomp $line; # this means that newlines will not be counted
$nlines++; # counts the lines
@words = split /s+/, $line;
$nwords += @words; # counts the words
@chars = split //,$line;
$nchars += @chars; # counts the characters

print @words;
my @sorted_words = sort @words;

print @sorted_words;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote