% Script/Function Filename:uicontrol
%     changeMakerGUI.m
% Purpose:
%     Enter the purpose of the function/file here
%
% Record of modifications:
%     Programmer(s): {Your Name}
%     Date Due: YYYY-MM-DD
%     Date Submitted: YYYY-MM-DD
%     References: ????
%     Help Received: ????
%
% Variables Used:
%     Enter the variables that you use here

changeToMake = randi( 100 ) - 1;
change = uicontrol( 'style' , 'slider' , 'units' , 'normalized' , ...
    'position' , [ 0 0 1 0.05 ] , 'min' , 0 , 'max' , 100 , ...
    'value' , changeToMake );
[ q , d , n , p ] = makeChange( changeToMake );
spaces = zeros( 2 , 4 );
x = [ 0 1 / 4 2 / 4 3 / 4 ];
for i = 1 : 4
    spaces( 1 , i ) = uicontrol( 'style' , 'text' , 'units' , 'normalized' , ...
        'fontunits' , 'normalized' , 'fontname', 'fixedwidth' , ...
        'position' , [ x( i ) 3 / 4 1 / 4 1 / 4 ] , 'string' , ...
        ' ' , 'fontsize' , 1 );
    spaces( 2 , i ) = uicontrol( 'style' , 'text' , 'units' , 'normalized' , ...
        'fontunits' , 'normalized' , 'fontname', 'fixedwidth' , ...
        'position' , [ x( i ) 2 / 4 1 / 4 1 / 4 ] , 'string' , ...
        ' ' , 'fontsize' , 1 );    
end

amount = uicontrol( 'style' , 'text' , 'units' , 'normalized' , ...
    'fontunits' , 'normalized' , 'fontname', 'fixedwidth' , ...
    'position' , [ 0 0.05 1 3 / 10 ] , 'string' , ...
    sprintf( '$%01.2f' , changeToMake / 100 ) , ...
    'fontsize' , 1 );

set( spaces( 1 , 1 ) , 'fontsize' , 0.25 , 'string' , 'Quarters' );
set( spaces( 1 , 2 ) , 'fontsize' , 0.25 , 'string' , 'Dimes' );
set( spaces( 1 , 3 ) , 'fontsize' , 0.25 , 'string' , 'Nickels' );
set( spaces( 1 , 4 ) , 'fontsize' , 0.25 , 'string' , 'Pennies' );
set( spaces( 2 , 1 ) , 'string' , num2str( q ) );
set( spaces( 2 , 2 ) , 'string' , num2str( d ) );
set( spaces( 2 , 3 ) , 'string' , num2str( n ) );
set( spaces( 2 , 4 ) , 'string' , num2str( round( p ) ) );
addlistener( change , 'ContinuousValueChange' , @ourChangeListener );
set( 1 , 'UserData' , { spaces amount } );