function [ result, square, linear ] = quadratic( a, b, c, x )
% QUADRATIC - Calculates the polynomial A x^2 + B x + C
%
%   QUADRATIC( A, B, C, X ) calculates the quadratic polynomial:
%       A * X^2 + B * X + C

%    Written April 2010 by John Bell for CS 109
%
if( nargin < 4 )
    x = 1;
end
square = a * x * x;
linear = b * x;
constant = c;

result = addThree( square, linear, constant );

function total = addThree( x, y, z )
total = x + y + z;