Question: Please use the Go programming language Consider the following array of points defined in the code below: package main import fmt type Point struct {

Consider the following array of points defined in the code below: package main import "fmt" type Point struct \{ x float 64 y float 64 func main() 1 points := [] Point {{8.,1},.{3.,2},.{7.,4},.{6.,3}. a) Implement function MidPoint that takes as input two Points defining a line and that computes: a. The coordinates of the mid-point of the line b. The length of the line. Your function should print the computed mid-point and length (rounded to 2 decimal places) in the following format. Points: (2,4)(6,8) MidPoint =(4.0,6.0) Length =5.66 b) In a main function, call the Midpoint function for all combination of two Points in the set of Points defined by the array ( 6 in total). These function calls are done using go functions (therefore executed in distinct threads). Add to your program all necessary synchronisation mechanisms such that your main function will terminate only when all threads are completed. i. Perform the synchronisation using channels only
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
