% Script squarish
% Given two points that are the opposing vertices of a rectangle,
% draw a squarish version of the rectangle.

% Set up the window
close all         % Close all previous figure windows
figure            % Start a new figure window
hold on           % Keep the same set of axes (multiple plots on same axes)
axis equal        % unit lengths on x- and y-axis are equal
axis([0 10 0 10]) % x-axis limits [0,10], y-axis limits [0,10]

%%% Do not change the code above %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Modify the code below %%%%%%%%%%

% Point 1
x1=4;  y1=6;
plot(x1, y1, 'bo')          % blue circle

% Point 2
x2=8.5;  y2=9;
plot(x2, y2, 'm+')          % magenta cross

% Two sides of the rectangle with opposing corners at points 1 and 2
plot([x1 x2],[y1 y1],'k:')  % black dotted line
plot([x2 x2],[y1 y2],'b')   % blue solid line (solid line is the default)

% Point 3, user-clicked point
title('Click on the plot below')
[xu, yu]= ginput(1);
plot(xu, yu, 'k*')          % black asterisk
messageToShow= sprintf('You clicked at (%.1f,%.1f)', xu, yu);
title(messageToShow)




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Do not change the code below %%%

hold off