Visa application centre
Description:
You recently started working in a Visa application office. As the work is boring and repetitive you decide to write some functionality to help you with the job.
Task:
Given an array of objects that represent people, complete the function visa
that should return all the people who have been approved.
In other words the function should return the same array back, with the inelligable people removed, and the elligable objects modified.
Each person is represented as an object with the following properties:
firstName (string),
.
lastName (string),
criminalRecord (boolean),
passportExpiration (string) // format dd.mm.yyyy,
visaType (string) // can be either 'business' or 'tourist'
Your job is to filter out all people whose passport expired (passportExpiration
property should be at least 90 days from now to be considered valid) and who have a criminal record (criminalRecord
should be false).
Every application (object) that meets the requirements should have two additional properties: visaExpiration (string)
and insuranceId (number)
.
If an applicants visaType
is 'business'
, the visaExpiration
should be set to a string in the format dd.mm.yyyy
90 days from now. If, however, the person applied for a 'tourist'
visa the same property should be set to 30 days from now.
The insuranceId
property is calculated as the sum of ASCII values from all characters in firstName
and lastName
.
Have fun!
Similar Kata:
Stats:
Created | Dec 16, 2016 |
Published | Dec 16, 2016 |
Warriors Trained | 240 |
Total Skips | 5 |
Total Code Submissions | 2942 |
Total Times Completed | 59 |
JavaScript Completions | 59 |
Total Stars | 13 |
% of votes with a positive feedback rating | 74% of 37 |
Total "Very Satisfied" Votes | 24 |
Total "Somewhat Satisfied" Votes | 7 |
Total "Not Satisfied" Votes | 6 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |