Click here to Skip to main content
15,312,535 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
The program you create needs to:
Able to enter the teams name
Able to record the score data for 5 tries
Able to visualize the recorded data
Can analysis the data recorded
Can interpolate the score for every 0.5 tries
My problem is that it doesn't want to run the program I can't figure out the problem with my code

What I have tried:

VB
disb('Catapult Game Calculation System')
p=2;
while p<=2
    Game=input('Enter your Group Name:','s');
    fprint('Group Name: %s\n',Game);
    for n=1:5
        A(n)=input('Your Score?');
    end
    fprint('1st score:%.2f\n',A(1))
    fprint('2nd score:%.2f\n',A(2))
    fprint('3rd score:%.2f\n',A(3))
    fprint('4th score:%.2f\n',A(4))
    fprint('5th score:%.2f\n',A(5))
    Total=A(1)+A(2)+A(3)+A(4)+A(5);
   fprint('Total Score:%2.1f\n',Total)
   x=1:5;
   subplot(2,1,1)
   stem(x,A,'-*b')
   title('Game score')
   xlabel('Number of tries')
   ylabel('FINAL Score')
   y=[A(1)A(2)A(3)A(4)A(5)];
   n1=1:5;
   n2=1:0.5:5;
   ysline=interp1(n1,y,n2,'splin');
   subplot(2,1,2)
   plot(n2,ysline,'-*r')
   statice=[mean(A) max(A) min(A) median(A) var(A) std(A)];
   disp('Score analysis')
   disp('mean max min median variance standard deviation')
   fprint('Score:%3.2f%9.2f510.2f%13.2f%15.2f\n',statics)
   replay=input('End of Game! play again? (Y for yes, N for no):','s');
   if replay=='N'
       disp('Thank You');
       break
   end
end
Posted
Updated 29-Jan-21 6:26am
v2
Comments
Richard MacCutchan 29-Jan-21 10:19am
   
What is the question?

This is the same "question" you posted yesterday: I need to create a program that can be used to record a game results[^] and the answer hasn't changed. Your teacher didn't like your homework, you are supposed to do it again and better. That means "you do the work" not "you get others to do it for you".

You will get nowhere in life until you rethink your mental attitude.
   
Comments
Anonymous197 29-Jan-21 10:15am
   
It’s a different code and my question is that it shows error when I try to run no need to be that rude if you are not welling to help don’t but you have no right to talk trash to people I didn’t ask for an answer to my project I just want someone to help me with why it shows error at the end
OriginalGriff 29-Jan-21 10:24am
   
And what have you done to find out?
What does the debugger show you?
Anonymous197 29-Jan-21 10:41am
   
When I click run it says code error and I don’t know what is the error in my code I tried alot but still the same
OriginalGriff 29-Jan-21 12:08pm
   
"And what have you done to find out?
What does the debugger show you?"

You don't just run code and expect it to work: you have to look at what it *is* doing and work out from there. So: break out the debugger, and start looking at what it happening and where.
parse error near line 22 of file /home/jdoodle.m

  syntax error

>>>    y=[A(1)A(2)A(3)A(4)A(5)];
              ^

Not too difficult to see.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900