varoag
asked on
need help with Scala function
I need to create a method in scala
that estimate how many people from `data` will be alive in `year`.
def estimatePopulation(data: List[List[String]], year: Int): Int = ???
Data refers to a file that reads
("1930, "67", "76")
("1950, "65", "77")
("1970, "64", "76")
where:
the first number represents a year
the second represents the life expectancy of a man
the third represents the life expectancy of a woman
example:
" A man born in 1930 has a life expectancy of 67 years."
How to write that function?
that estimate how many people from `data` will be alive in `year`.
def estimatePopulation(data: List[List[String]], year: Int): Int = ???
Data refers to a file that reads
("1930, "67", "76")
("1950, "65", "77")
("1970, "64", "76")
where:
the first number represents a year
the second represents the life expectancy of a man
the third represents the life expectancy of a woman
example:
" A man born in 1930 has a life expectancy of 67 years."
How to write that function?
There must be another set of data, the number of men and women born in each year.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.