Question

Consider the following data, formatted in the previous lab as shown below: F gge0001x gge0001y gge0001z...

Consider the following data, formatted in the previous lab as shown below:

F gge0001x gge0001y gge0001z

D 12-30-2006 12-30-2006 12-30-2006

T 14:15:20 14:15:55 14:16:27

S a69 a69 a69

B 15.8 16.1 15

M gge06001 gge06001 gge06001

P 30.1 29.6 29.9

Q 20.2 22.3 23.4

R 1006.2 1003.5 999.8

U 1011.8 1011.8 1005

X 34.7 35.2 35.1

A 38.994 38.994 38.994

G 107.71 107.71 107.71

H 8.395 8.406 8.368

O 37.141 36.823 36.621

C 7.55 7.532 7.437

K 28.193 27.902 27.856

W 212.86 210.15 207.15

L 68.3 67.9 67.6

Write a perl script called lab6.2.pl that will process this data file to determine the average performance output of the module. Upon processing, the data is to be presented as shown in the table below:

Performance Data

Date    12/30/2006

Tamb (°C)       15.63

Tref (°C)         29.87

Tm (°C)           21.97

Irradiance (W/m^2) 1003.17

Isc (A) 8.39

Voc (V)           36.86

Imp (A)           7.51

Vmp (V)          27.98

Pm (W)           210.05

FF (%) 67.93

Your Perl program must the strict and constant pragmas, must include subroutines, must use the features and functions covered in the Unit, and remember to include detailed comments!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi friend, Please find my implementation:

#!/usr/bin/perl

use strict;
use warnings;

# opening the file in read mode
open(FH, "tempfile.txt") or die "file tempfile.txt cannot be opened : $!";

print "Performance Data\n";
# iterating through each line in file
while(my $line = <FH>){
        # splitting the line and storing into each_line array
        my @each_line = split(/\s+/, $line);
        # passing each line to formatting function
        formatting(@each_line); 
}

# closing the file
close(FH);

# method to format given line
sub formatting{
        my @line = @_;

        # storing the first character in sym variable   
        my $sym = $line[0];

        # formatting the given line
        if ($sym eq "D"){
                $line[1] =~ s/\-/\//g;
                printf "Date $line[1]\n"; 
        }
        elsif ($sym eq "B"){
                printf "Tamb (°C) %.2f\n", $line[1];
        }
        elsif ($sym eq "P"){
                printf "Tref (°C) %.2f\n", $line[1];
        }
        elsif ($sym eq "Q"){
                printf "Tm (°C) %.2f\n", $line[1];
        }
        elsif ($sym eq "R"){
                printf "Irradiance (W/m^2) %.2f\n", $line[1];
        }
        elsif ($sym eq "H"){
                printf "Isc (A) %.2f\n", $line[2];
        }
        elsif ($sym eq "O"){
                printf "Voc (V) %.2f\n", $line[1];
        }
        elsif ($sym eq "C"){
                printf "Imp (A) %.2f\n", $line[1];
        }
        elsif ($sym eq "K"){
                printf "Vmp (V) %.2f\n", $line[1];
        }
        elsif ($sym eq "W"){
                printf "Pm (W) %.2f\n", $line[1];
        }
        elsif ($sym eq "L"){
                printf "FF (%%) %.2f\n", $line[1];
        }
        
}

Formatted code: http://pasted.co/94ec6249

Terminal Shell Edit View Window Help Perl--bash-181x48 Unix Terminal> ./lab6.2.pl Performance Data Date 12/30/2006 Tamb (°C)

Please DONT forgot to rate my answer. We are working hard for you Guys!!

Add a comment
Know the answer?
Add Answer to:
Consider the following data, formatted in the previous lab as shown below: F gge0001x gge0001y gge0001z...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The data shown below represent the age in weeka) at which babies frut crawl, based on...

    The data shown below represent the age in weeka) at which babies frut crawl, based on a survey of 12 mother completo porta (8) through (c) below. 5230 44350 47 26 90353062 Clos here to view the fubiectertion constaton coefficient for normal orobabile Click here to view.pronto the standard rom. dirbtitatie, Click here view.pon 20 the standard somal distribution Care for the table critical () Draw a normal probability plot to determine is reasonable to conclude the data come from...

  • 1. According to the paper, what does lactate dehydrogenase (LDH) do and what does it allow...

    1. According to the paper, what does lactate dehydrogenase (LDH) do and what does it allow to happen within the myofiber? (5 points) 2. According to the paper, what is the major disadvantage of relying on glycolysis during high-intensity exercise? (5 points) 3. Using Figure 1 in the paper, briefly describe the different sources of ATP production at 50% versus 90% AND explain whether you believe this depiction of ATP production applies to a Type IIX myofiber in a human....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT