Recruitment Chance
Write a code to estimate the probability of an applicant being hired based on GPA. The input is a numeric called GPA and the output is chanceHired, equal to the probability of an applicant based on the following table.
GPA >= 3.5 Probability 90%
3.0 <= GPA < 3.5 Probability 80%
2.5 <= GPA < 3.0 Probability 70%
2.0 <= GPA < 2.5
Probability 60%
1.5 <= GPA < 2.0 Probability 50%
GPA < 1.5 Probability 40%
Hint: use if else conditionals to check the GPA ranges. Use the following array to test your code: applicants
GPA=[0.5:4] and display the result in a matrix form using fprintf(5pt). E.g. If matrix A=[1 2; 3 4] then to print it in matrix form use fprintf('%i%i\n', matrixA').
GPA=[0.5:4];
% initialize matrix of zeroes for probability
result=zeros(size(GPA));
% iterate over GPA
for i=1:size(result,2)
% assign probability according to GPA
if GPA(i)>=3.5
result(i)=0.9;
elseif GPA(i)>=3.0
result(i)=0.8;
elseif GPA(i)>=2.5
result(i)=0.7;
elseif GPA(i)>=2.0
result(i)=0.6;
elseif GPA(i)>=1.5
result(i)=0.5;
else
result(i)=0.4;
end
end
% display result
fprintf('%i %i\n',result);
Output:

Recruitment Chance Write a code to estimate the probability of an applicant being hired based on...