Engineering
Suppose you are implementing a relational employee database, where the database is a list of tuples formed by the names, the phone numbers and the salaries of the employees. For example, a sample database may consist of the following list of tuples:[("John", "x3456", 50.1) ; ("Jane", "x1234", 107.3) ; ("Joan", "unlisted", 12.7)]Note that I have written parentheses around the tuples to make them more readable, but the precedences of different operators in OCaml make this unnecessary.Define a functionfind_salary : ((string * string * float) list) -> string -> floatthat takes as input a list representing the database and the name of an employee and returns his/her corresponding salary. Think also of some graceful way to deal with the situation where the database does not contain an entry for that particular name, explain it, and implement this in your code.Define a functionfind_phno : ((string * string * float) list) -> string -> stringthat is like find_salary, except that it returns the phone number instead.What I have so far:let rec find_salary li nm =let rec helper name s =match li with| [] -> 0.0| (n, p, s) :: t -> if (name = n) then selsehelper t name
Consider an 8-car caravan, where the propagation speed is 100 km/hour, each car takes 1 minute to pass a toll both. The caravan starts in front of toll booth A, goes through toll booth B, and ends after passing toll booth C. Let dAB and dBC be the distance between A-B, and B-C. a. Suppose dAB = dBc = 10 km. What is the end-to-end delay if the caravan travels together (i.e., the first car must wait for the last car after passing each toll booth)? b. Repeat a), but assume the cars travel separately (i.e., not waiting for each other). c. Repeat a) and b), but suppose dAB = dBC =100 km d. Still suppose dAB = dBC = 100 km. Suppose toll booth B takes 10 minute to pass each car (A and C still takes 1 minute per car). Where is the first car when the second car passes B? e. Under the assumption of d), what is the maximum value of dBC such that the first car has passed C when the second car passes B?