function [] = cereal(bf,wg,m,steel,bb)
%cbf = bf* 110/29;    pbf = bf*.0497;      %Spartan
 cbf = bf* 90/29;     pbf = bf*.036;       %Raleys
%cbf = bf* 190/53;    pbf = bf*.0582;      %Rasin Bran
 cwg = wg* 50/13;     pwg = wg*.0554;      
%cm = m * 110/242.6;  pm  = m *.0100;      %MI 
 cm = m * 130/242.6;  pm  = m *.0116;      
%cm = m * 130/242.6;  pm  = m *.0124;  
 cs  = steel * 150/220; ps  = steel*.0653;   
 cbb = bb* 39/72;     pbb = bb*.0067;      
total = pbf+pwg+pm+ps+pbb;  totalCal = cbf+cwg+cm+cs+cbb;

fprintf('%3d bf   =  %5.1f cal = %3.1f ~= %d', bf, cbf, pbf, intPart(pbf));
   printQ(pbf); fprintf('\n');
fprintf('%3d wg   =  %5.1f cal = %3.1f ~= %d', wg, cwg, pwg, intPart(pwg));
   printQ(pwg);fprintf('\n');
fprintf('%3d milk =  %5.1f cal = %3.1f ~= %d', m, cm, pm, intPart(pm));
   printQ(pm);fprintf('\n');
fprintf('%3d steel=  %5.1f cal = %3.1f ~= %d', steel, cs, ps, intPart(ps));
   printQ(ps);fprintf('\n');
fprintf('%3d blue =  %5.1f cal = %3.1f ~= %d', bb, cbb, pbb, intPart(pbb));
   printQ(pbb);fprintf('\n');
fprintf('    total=  %5.1f cal = %3.1f ~= %d', totalCal, total, intPart(total));
   printQ(total);fprintf('\n');

function nq=quarters(value)
%
% Find the nearest 1/4
%
nq = mod(round(value*4),4);

function ip = intPart(value)
%
ip = floor(value);
%
% Handle the case where the nearest quarter is the next higher integer,
% i.e. 5.9 -> 6.
%
if(value > 0 & quarters(value) == 0)
    ip = round(value);
end

function printQ(value)
%
nq = quarters(value);
%
if(nq)
    if(nq == 2)
        fprintf(' 1/2');
    else
        fprintf(' %d/4', nq);
    end
else
    fprintf('    ');
end

return
