I need help setting out puts for input age values >0 has to be wrong input 0-12 has to be Younger than a teenager 13-19 teenager and anything over 19 has to be Older than a Teenager please its for my final I can't figure it out Its due in 30 minutes thanks in advance

댓글 수: 4

Adam
Adam 2017년 3월 16일
It's not obvious what you actually want to do. Plus if it is so important why have you left it until 30 minutes before it is due to suddenly ask for help?! You need to be a lot more precise about what you want if you want quick assistance.
William Wessels
William Wessels 2017년 3월 16일
I want my professor to be able to input a value and a response answer his input. If he inputs a value under 0 I want it to say "Wrong Input" any value 0-12 to say "Younger than Teenager" 13-19 "Teenager" >19 "Older Than Teenager" Thanks in advance
William Wessels
William Wessels 2017년 3월 16일
Its a questions on my exam and we only have 30m to figure it out. Its a complex if and elseif statement. I just can't seem to crack it
Jan
Jan 2017년 3월 16일
William, seriously, your professor knows this forum also. The solution does definitely not contain "complex if else statements" but the question is nearly trivial.
You ask us for helping you with cheating. I do not like this.

댓글을 달려면 로그인하십시오.

답변 (1개)

ES
ES 2017년 3월 16일

0 개 추천

if age<0
output = 'ERROR';
elseif age>0 && age<12
output = 'Younger than a Teenager';
elseif age>12 && age<19;
output = 'Teenager';
elseif age>19
output = 'Older than a Teenager';
end
disp(output);
This is the best I could understand out of your requirements.

댓글 수: 1

Jan
Jan 2017년 3월 16일
편집: Jan 2017년 3월 17일
This is a question on William's exam and he wants the forum to solve this for him. I cannot imagine why he has internet access during the exams, but it looks like he wants to cheat.
It is bad for the reputation of this forum if we help him with cheating.
[EDITED] I assume the exam has been finished.
What happens for age== 0, 12, 19? A <= is required. When you have checked for <= 12 already, the next test > 12 can be omitted.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2017년 3월 16일

편집:

Jan
2017년 3월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by