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

I\'d like this done in linux with P erl. Thanks for your help! Performance Data

ID: 3796191 • Letter: I

Question

I'd like this done in linux with Perl. Thanks for your help!

Performance Data

Date

12/30/2006

Tamb (°C)

15.8

Tref (°C)

30.1

Tm (°C)

20.2

Irradiance (W/m^2)

1006.2

Isc (A)

8.40

Voc (V)

37.14

Imp (A)

7.55

Vmp (V)

28.19

Pm (W)

212.86

FF (%)

68.3

The data in the table above are average values from 3 repeated measurements on panel id gge001. The 3 measurements gge001x, gge001y, and gge001z are shown in the table/file 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

You are to write a Perl program that produces the “Performance Data” table as shown above.

Note the corresponding rows:

Date D

Tamb B

Tref P

Tm Q

Irradiance R

Isc H

Voc O        

Imp C

Vmp K

Pm W

FF L

You will submit 1 file: Your script file, called lab6.pl

Your Perl program must adhere to the following requirements:

Must use the pragmas below:

use strict

use constant

Must include subroutines

Must only use the features or functions covered in the Unit. Note that features have wide range of options. Online documentation, reference materials, and other search engine can be used to explore those many options for efficient code.

Performance Data

Date

12/30/2006

Tamb (°C)

15.8

Tref (°C)

30.1

Tm (°C)

20.2

Irradiance (W/m^2)

1006.2

Isc (A)

8.40

Voc (V)

37.14

Imp (A)

7.55

Vmp (V)

28.19

Pm (W)

212.86

FF (%)

68.3

Explanation / Answer

- Create empty tables to hold order details
CREATE TABLE valid_orders (cust_name VARCHAR2(32), amount NUMBER(10,2));
CREATE TABLE big_orders AS SELECT * FROM valid_orders WHERE 1 = 0;
CREATE TABLE rejected_orders AS SELECT * FROM valid_orders WHERE 1 = 0;
DECLARE
-- Make collections to hold a set of customer names and order amounts.
SUBTYPE cust_name IS valid_orders.cust_name%TYPE;
TYPE cust_typ IS TABLe OF cust_name;
cust_tab cust_typ;
SUBTYPE order_amount IS valid_orders.amount%TYPE;
TYPE amount_typ IS TABLE OF NUMBER;
amount_tab amount_typ;
-- Make other collections to point into the CUST_TAB collection.
TYPE index_pointer_t IS TABLE OF PLS_INTEGER;
big_order_tab index_pointer_t := index_pointer_t();
rejected_order_tab index_pointer_t := index_pointer_t();
PROCEDURE setup_data IS BEGIN
-- Set up sample order data, including some invalid orders and some 'big' orders.
cust_tab := cust_typ('Company1','Company2','Company3','Company4','Company5');
amount_tab := amount_typ(5000.01, 0, 150.25, 4000.00, NULL);
END;
BEGIN
setup_data();
DBMS_OUTPUT.PUT_LINE('--- Original order data ---');
FOR i IN 1..cust_tab.LAST LOOP
DBMS_OUTPUT.PUT_LINE('Customer #' || i || ', ' || cust_tab(i) || ': $' ||
amount_tab(i));
END LOOP;
-- Delete invalid orders (where amount is null or 0).
FOR i IN 1..cust_tab.LAST LOOP
IF amount_tab(i) is null or amount_tab(i) = 0 THEN
cust_tab.delete(i);
amount_tab.delete(i);
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('--- Data with invalid orders deleted ---');
FOR i IN 1..cust_tab.LAST LOOP
IF cust_tab.EXISTS(i) THEN
DBMS_OUTPUT.PUT_LINE('Customer #' || i || ', ' || cust_tab(i) || ': $' ||
amount_tab(i));
END IF;
END LOOP;
-- Because the subscripts of the collections are not consecutive, use
-- FORALL...INDICES OF to iterate through the actual subscripts,
-- rather than 1..COUNT
FORALL i IN INDICES OF cust_tab
INSERT INTO valid_orders(cust_name, amount)
VALUES(cust_tab(i), amount_tab(i));
-- Now process the order data
-- Extract 2 subsets and store each subset in a different table
setup_data(); -- Initialize the CUST_TAB and AMOUNT_TAB collections again.
FOR i IN cust_tab.FIRST .. cust_tab.LAST LOOP
IF amount_tab(i) IS NULL OR amount_tab(i) = 0 THEN
rejected_order_tab.EXTEND; -- Add a new element to this collection
-- Record the subscript from the original collection
rejected_order_tab(rejected_order_tab.LAST) := i;
END IF;
IF amount_tab(i) > 2000 THEN
big_order_tab.EXTEND; -- Add a new element to this collection
-- Record the subscript from the original collection
big_order_tab(big_order_tab.LAST) := i;
END IF;
END LOOP;
-- Now it's easy to run one DML statement on one subset of elements,
-- and another DML statement on a different subset.
FORALL i IN VALUES OF rejected_order_tab
INSERT INTO rejected_orders VALUES (cust_tab(i), amount_tab(i));
FORALL i IN VALUES OF big_order_tab
INSERT INTO big_orders VALUES (cust_tab(i), amount_tab(i));
COMMIT;
END;
/
-- Verify that the correct order details were stored
SELECT cust_name "Customer", amount "Valid order amount" FROM valid_orders;
SELECT cust_name "Customer", amount "Big order amount" FROM big_orders;
SELECT cust_name "Customer", amount "Rejected order amount" FROM rejected_orders;

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