% Typical solutions to questions from Math 230 hour exam 1.

%% Question 1, calculate bill from auto mechanic.
Parts = 44.95;
Labor = 30;
Subtotal = Parts + Labor;
Tax = Subtotal * 0.08
Total = Subtotal + Tax

%% Question 2, plot a pointed curve.
t = linspace( 0, 1, 100 );
x = 4 * t.^3 - 6 * t.^2 + 3 * t;
y = 3 * ( t - t.^2 );
plot( x, y );

%% Question 3, matrix multiplication demo.
n = input( 'Enter the size of the matrix ' );
M = n * ones( n );
R = 1 ./ M;
M * R

%% Question 4, encryption.
% Start by reading a plaintext from the user, even though not required in
% the exam question.
P = input( 'Enter your plaintext ' );
key = rand( 1, length(P) );
C = [ key .* P, sum(P) ]