필터 지우기
필터 지우기

Random inputs for a logic array?

조회 수: 1 (최근 30일)
Olivia Rose
Olivia Rose 2022년 4월 2일
답변: KSSV 2022년 4월 2일
This is my current code:
function [averageScores, deviationScores, medianScores, modeScores, partyDecision] = PizzaParty(scores)
averageScores=mean(scores)
deviationScores=std(scores)
medianScores=median(scores)
modeScores=mode(scores)
partyDecision=(averageScores&modeScores)
if averageScores>=85, modeScores>=75
partyDecision=true
elseif averageScores<=85, modeScores<=75
partyDecision=false
end
end
It works to satisfy the first requirement, but I'm not sure how to go about satisfying the second requirement and error as stated below:
"Check that given random scores as the input, all the output variables are calculated correctly.
Variable partyDecision has an incorrect value. Check the logic used to calculate whether the party will be held."

채택된 답변

KSSV
KSSV 2022년 4월 2일
function [averageScores, deviationScores, medianScores, modeScores, partyDecision] = PizzaParty(scores)
averageScores=mean(scores)
deviationScores=std(scores)
medianScores=median(scores)
modeScores=mode(scores)
% partyDecision=(averageScores&modeScores) Not needed
if averageScores>=85 && modeScores>=75
partyDecision=true
else
partyDecision=false
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by