Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Write a function called eligible that helps the admission officer of the Graduate School of Vanderbilt University decide whether the applicant is eligible for admission based on GRE scores. The function takes two positive scalars called v and q as in
1 回表示 (過去 30 日間)
古いコメントを表示
Write a function called eligible that helps the admission officer of the Graduate School of Vanderbilt University decide whether the applicant is eligible for admission based on GRE scores. The function takes two positive scalars called v and q as input and returns the logical admit as output. They represent the percentiles of the verbal and quantitative portions of the GRE respectively. You do not need to check the inputs. The applicant is eligible if the average percentile is at least 92% and both of the individual percentiles are over 88%. The function returns logical true or false value.
Your Function
function ans=eligible(v,q);
if v>=92 && q>=88;
ans=true
else
ans=true
end
0 件のコメント
回答 (1 件)
Mario Chiappelli
2019 年 7 月 18 日
First off, you have ans set to true in both cases. So change the else statement to be equal to false. Other than that your function should work.
Then call the function like this:
answer = eligible(v,q);
or if you are looping through a database:
answer = double(num); % Where num is the number of applicants
for i = 1:num
answer(i) = eligible(v(i),q(i)); % Where v and q are arrays of data.
end
0 件のコメント
この質問は閉じられています。
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!