Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Help For Java Homework Exercise 1 Write a generic method myRepl that given an integer n and a value v ( of type T

Need Help For Java Homework
Exercise 1
Write a generic method myRepl that given an integer n and a value v (of type T) returns a list of length n initialized with v, namely all elements are equal to v.
No loops, recursion permitted in the following exercises 2--6. You can write and use auxiliary functions also without loops/recursion. You can use the map, filter, foldL, flatmap that you have written already.
Exercise 2
Write a function sumOdd that given a list of integers computes the sum of the values that are odd. (Use foldleft,filter)
Exercise 3
Write a function repl that given a list xs and a integer n returns a list containing the elements of xs replicated n times. ( Use flatmap, myRepl)
Exercise 4
Write a function totalLength that given a list of strings xs computes the sum of the lengths of the strings starting with the character 'A'.( Use map, filter, foldL )
Exercise 5
Write a function titlecase that given a list of strings converts it to titlecase by uppercasing the letters of every word that starts with an a.
Exercise 6
Write a function countVowelPali that given a list of strings xs returns the total number of vowels in strings that are palindromes. For example,
countVowelPali ["anna", "banana", "civic", "mouse"]=4Write a generic method myRepl that given an integer n and a value v (of type T) returns a list of length n initialized with v, namely all elements are equal to v.
No loops, recursion permitted in the following exercises 2--6. You can write and use auxiliary functions also without loops/recursion. You can use the map, filter, foldL, flatmap that you have written already.
Exercise 2
Write a function sumOdd that given a list of integers computes the sum of the values that are odd. (Use foldleft,filter)
Exercise 3
Write a function repl that given a list xs and a integer n returns a list containing the elements of xs replicated n times. ( Use flatmap, myRepl)
Exercise 4
Write a function totalLength that given a list of strings xs computes the sum of the lengths of the strings starting with the character 'A'.( Use map, filter, foldL )
Exercise 5
Write a function titlecase that given a list of strings converts it to titlecase by uppercasing the letters of every word that starts with an a.
Exercise 6
Write a function countVowelPali that given a list of strings xs returns the total number of vowels in strings that are palindromes. For example,
countVowelPali ["anna", "banana", "civic", "mouse"]=4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

Students also viewed these Databases questions

Question

Use a three-step process to develop effective business messages.

Answered: 1 week ago