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

Implement the following functions in a Scala worksheet: An instructor maintains

ID: 3724460 • Letter: I

Question

Implement the following functions in a Scala worksheet:

An instructor maintains a list of lists of exam scores:

var cs152 = List(List(93, 89, 90), List(75, 76, 68), List(88, 82, 78))

The first list represents the scores of student 1, the second student 2, etc.

Write the following functions for processing lists of this form:

def avg(scores: List[Double]): Double = avg of scores

def avgAvg(scores: List[List[Double]]): List[Double] =
   list of averages for each student

def passing(scores: List[List[Double]]): List[Int] =

list of positions in the list with avg >= 70

def sumSums(scores: List[List[Double]]):Double = sum of sums of all scores

Explanation / Answer

Scala worksheet is a coding environment in which code is executed parallely while writing.

Please under stand some functions of scala

list.sum() => retuens the sum of all the element of the sum

list.length=> returns the number of element in the list

filter() =>filter the list records based on conditions

list.map() => Iterate over list element and perfoms specified functionalilty.

######################################################################

//Please create scala worksheet and one object in that object Copy below code in like I did in individula solution.

//Calling above functions

###############################################################

//Understand each solution one by one

****************************Solution 1 average of scores***************************

//Inside worksheet copy below code and execute or you can copy code from object  AverageScoreCalc

************************Solution 2 avgAvg fucntion*****************************

****************************Solution 3 list of positions *************************

***************************solution 4 sumSums **********************************

*****************************Summary Solution*************************

#######################################################

//Summary Output


avg: avg[](val scores: List[Double]) => Double

avgAvg: avgAvg[](val scores: List[List[Double]]) => List[Double]

passing: passing[](val scores: List[List[Double]]) => List[Int]

sumSums: sumSums[](val scores: List[List[Double]]) => Double


cs152: List[List[Double]] = List(List(93.0, 89.0, 90.0), List(75.0, 76.0, 68.0), List(88.0, 82.0, 78.0))

average: Double = 90.66666666666667
avgavg: List[Double] = List(90.66666666666667, 73.0, 82.66666666666667)

index: List[Int] = List(0, 1, 2)
sumOfSums: Double = 739.0