0

Can someone help me out with my code its saying complication error.

https://code.sololearn.com/cpd92Iz9X2xI/?ref=app

28th Oct 2017, 8:01 PM
jalen
jalen - avatar
14 ответов
+ 1
You have a bunch of coding errors. Your method doesn't return a value, yet you attempt to assign it to a variable. You're missing tons of }. RandomNumbers.sayNumber() is invalid so delete it.
28th Oct 2017, 10:47 PM
John Wells
John Wells - avatar
+ 1
Line 29 remove }
29th Oct 2017, 12:21 AM
John Wells
John Wells - avatar
0
I fixed the { } now it says there is 2 errors I can't seem to fix them https://code.sololearn.com/c5BL4rb1UACd/?ref=app
28th Oct 2017, 11:59 PM
jalen
jalen - avatar
0
I removed line 29 } now there's a brand new error Ive tried multiple things to fix it but it won't go away https://code.sololearn.com/c5BL4rb1UACd/?ref=app
29th Oct 2017, 6:09 PM
jalen
jalen - avatar
0
You are trying too much at once. I suggest you comment out most of the code and work on a piece at a time. The easiest way to build a program as a beginner is baby steps. Code a little piece and get it working. Then, add the next thing to build on it. Comment out all cases in the switch and work on getting case 2 working. You still haven't addressed all of the stuff in my first comment. Your break statement in your cases is nested within an if statement so it won't stop execution from continuing into the next case.
29th Oct 2017, 6:47 PM
John Wells
John Wells - avatar
0
I took your advice on coding little by little at a time and created a exact copy of the other code but shorter this time. I'm confused on what I should change RandomNumbers.sayNumber() with. https://code.sololearn.com/cZvdvbcnXevR/?ref=app
29th Oct 2017, 7:52 PM
jalen
jalen - avatar
0
I made it public what should I use instead of main?
29th Oct 2017, 7:59 PM
jalen
jalen - avatar
0
I created a different code could you help me on it? https://code.sololearn.com/cXWWzSFpUO6y/?ref=app
9th Nov 2017, 3:46 AM
jalen
jalen - avatar
0
You're still trying too much at once. You are referencing your arrays incorrectly. string[] a; int b; string n = b[a]; It should be a[b]. a is defined as the array, not b.
9th Nov 2017, 3:53 AM
John Wells
John Wells - avatar
0
wait why would I change the variable 'troop' to 'n' in string?
9th Nov 2017, 3:18 PM
jalen
jalen - avatar
0
I got it to compile. Still have problems with commented out code at line 171. https://code.sololearn.com/cN2SVUiRDO1L/?ref=app
9th Nov 2017, 4:24 PM
John Wells
John Wells - avatar
0
this is awesome but i noticed u made part of the code on lines 174 - 177 a comment, I was wondering if there was a way to make it to where the user is able to choose between 2 random troops?
11th Nov 2017, 6:16 AM
jalen
jalen - avatar
- 1
Make it public so I can comment on it. Your sayNumber method generates a random number and displays it. It doesn't return anything so main can't use it.
29th Oct 2017, 7:56 PM
John Wells
John Wells - avatar
- 1
You wouldn't. I was just giving an example.
9th Nov 2017, 3:25 PM
John Wells
John Wells - avatar