Using the chores.csv file fat the very bottom; write an awk script to return the average number of minutes required to complete a chore. Your solution must handle an undefined number of chores. zero points will be given to solutions that use a static number in their calculation.
Format floating point numbers to 2 decimal places.
Example output;
Average: 28.12
chores.csv
Chore Name,Assigned to,estimate,done?
Laundry,Chelsey,45,N
Wash Windows,Sam,60,Y
Mop kitchen,Sam,20,N
Clean cookware,Chelsey,30,N
Unload dishwasher,Chelsey,10,N
Dust living room,Chelsey,20,N
Wash the dog,Sam,40,N

Respuesta :

Answer: Provided in the explanation section

Explanation:

According to the question:

Using the chores.csv file fat the very bottom; write an awk script to return the average number of minutes required to complete a chore. Your solution must handle an undefined number of chores. zero points will be given to solutions that use a static number in their calculation.

Format floating point numbers to 2 decimal places.

Example output;

Average: 28.12

chores.csv

Chore Name,Assigned to,estimate,done?

Laundry,Chelsey,45,N

Wash Windows,Sam,60,Y

Mop kitchen,Sam,20,N

Clean cookware,Chelsey,30,N

Unload dishwasher,Chelsey,10,N

Dust living room,Chelsey,20,N

Wash the dog,Sam,40,N

ANSWER:

BEGIN{

FS=","

}

{

if(NR!=1)

sum += $3

}

END{

avg=sum/NR

printf("Average: %.2f ", avg)

}' ./chores.csv

cheers i hope this helped !!

Ver imagen Preciousorekha1