% -----------------------------------------------------
% usingscriptfiles.m
% -----------------------------------------------------
% Write a program to compute the average grade for a 
% set of 3 students. 
% -----------------------------------------------------
% Notes: none
% -----------------------------------------------------
% Copyright and license details available at matlabmarina.com
%------------------------------------------------------

clear;
clc;

% Given parameters (points of students x y and z)
x = 80
y = 100
z = 50
numVars = 3

% Compute the average
avg = (x + y + z) / numVars

% Note that no semicolons (;) are used to suppress the above commands
% so the user can check the variables and the outputs. 
% Overall, this is not good practice.  Suppress all commands and use
% appropriate display options to display the final outputs. 

% with semicolons to see difference
% Given parameters (points of students x y and z)
xx = 80;
yy = 100;
zz = 50;
numVars2 = 3;

% Compute the average
avg2 = (xx + yy + zz) / numVars2;

% display end result in the command window
disp('The average student grade is');
disp(avg2);
% OR use a formatted way to show the end result
fprintf('The average of the points is %0.3f\n', avg2);


