Basics of Scala: 10 simple tasks

Elements of Functional Programming – SCALA

The solution should contain instructions to write out results.

1. Create a 7-element list containing the names of the days of the week. Write it using:

a. Loop of type for

b. The for loop, listing only days with names beginning with "P"

c. Foreach method

d. While loop

e. Recursive function

f. Recursive function by writing elements of the list from the end

g. Foldl and foldr method

h. Foldl methods by writing only days with names beginning with "P"

2. Create a map with product names and prices. On its basis, generate another map with a 10% price reduction. Use the collection mapping mechanism.

3. Define a function accepting a tuple with three values of different types and writing them out

4. Present the Option operation on any example (e.g., a map in which we search for values by key)

5. Use Pattern Matching in a function that accepts a String parameter. For strings corresponding to the names of the days of the week, the function is to return "Work" and "Weekend" (respectively for working and non-working days), for the rest: "There is no such a day".

6. Define the KontoBankowe class with the methods of payment and withdrawal and property Account status - the property is to be read-only. The class should provide a constructor accepting the initial state of the account and another one, setting the initial account balance at 0.

7. Define the class Person with properties: name and surname. Create several instances of this class. Define a function that accepts the object of the person class and selects and returns the string containing the person's greeting by using Pattern Matching. Define 2-3 different greetings for specific people (with given names or surnames) and one default greeting.

8. Write a function that removes zero from the list of integer values (i.e. returning a new list containing values from the original list except for '0')

9. Define a function that accepts a list of integers and returns the list generated based on it, in which all numbers have been increased by 1. Use the collection mapping mechanism.

10. Create a function that accepts a list of real numbers and returns a list created on its basis containing the absolute values of elements from the original list within the range <-5,12>

Taidot: Scala

Näytä lisää: simple machines simple tasks, php simple tasks, cheap outsourcing simple tasks, scala concepts, scala guide, scala syntax, scala tutorial, scala overview, scala tutorial for python programmers, scala beginners, scala function, outsourcing simple tasks, haskell simple tasks, scala exercise simple, simple tasks work, simple tasks everyone can, simple tasks net, simple tasks data entry, extjs simple tasks source, extjs simple tasks web

Tietoa työnantajasta:
( 4 arvostelua ) Warszawa, Poland

Projektin tunnus: #19945757

2 freelanceria on tarjonnut keskimäärin 54$ tähän työhön


"Hi, Hope you are doing well! Thanks for sharing your project requirement with us. It will be our great pleasure to work on your project. I have checked your requirement, yes we can do it, because we already work on si Lisää

$27 USD 7 päivässä
(0 arvostelua)

Hi I'm an expert in scala programming. I'm sure that I can easily do this project. We can have a chat about it. Thanks..

$80 USD 1 päivässä
(0 arvostelua)