Question

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

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').

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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:

Add a comment
Know the answer?
Add Answer to:
Recruitment Chance Write a code to estimate the probability of an applicant being hired based on...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT