%% load and parse data
[num txt] = xlsread('schooldata.xls');

goals = zeros(size(num,1),1);
genders = zeros(size(num,1),1);

for i = 1:size(num,1)
    if strcmp(txt(i,1), 'boy')
        genders(i) = 1;                 %boy = 1
    elseif strcmp(txt(i,1), 'girl')
        genders(i) = 2;                 %girl = 2
    end
        
    if strcmp(txt(i,7), 'Sports')
        goals(i) = 1;
    elseif strcmp(txt(i,7), 'Grades')
        goals(i) = 2;
    elseif strcmp(txt(i,7), 'Popular')
        goals(i) = 3;
    end
end

%% Change default text fonts for figure
set(0, 'DefaultAxesFontName', 'Times New Roman');
set(0, 'DefaultAxesFontSize', 18);

%% plot gender bar
genders_count = [sum(genders==1), sum(genders==2)];     %get the count of boys and girls
figure(1);  %set the window in which the figure will be put
clf;        %clear the figures
bar(genders_count);                                         %plot the bar chart of counts per gender
set(gca, 'XTick', [1 2], 'XTickLabel', {'boy', 'girl'});    %set X-Tick locations and labels
title('Number of childen of each gender');                  %set title of the plot

%% plot goal bar
goals_count = [sum(goals==1), sum(goals==2), sum(goals==3)];
figure(2);
bar(goals_count);
set(gca, 'Xtick', [1 2 3], 'XTickLabel', {'Sports', 'Grades', 'Popular'});
title('Number of children choosing each goal');


