Final answer:
To create a script in the terminal using vi/vim, ask the user for values of x2 and y2, compute the midpoint using the formulas given, and display the result. Make the script executable and run it from the terminal.
Step-by-step explanation:
To create a script in the terminal, you can use the vi or vim text editor. First, open the terminal and type 'vi lab7' to create a new script named lab7. Press 'i' to enter insert mode and add a comment at the top of the file with your name, class, and section number. For example, '#John Doe, EMT 2390L - ABC123'.
Next, you need to ask the user for the values of x2 and y2 for point 2. You can use the following command in the script to prompt the user for input:
'read -p "Enter x2: " x2; read -p "Enter y2: " y2;'
After obtaining the values of x2 and y2, you can use the midpoint formulas to compute the midpoint. The formulas are:
a) x_mid = (x1 + x2) / 2
b) y_mid = (y1 + y2) / 2
To display the midpoint results on the screen, you can use the 'echo' command with the computed values. For example, 'echo "($x_mid, $y_mid)"'.
To make the script executable, you can use the chmod command with the mode 755. Execute the script using the './lab7' command.