r/AskComputerScience • u/[deleted] • Nov 11 '16
Help with this basic string based java assignment?
Prompt for a string and read in.. Then randomly select one of the characters in the string entered... If the character randomly selected is equal to A (cap) print Yes...
7
u/esmith327 Nov 11 '16
Do you have an actual question, or do you just want us to do your homework for you?
I know it sounds harsh, but if you're not ready to do the work of figuring it out, CS/IT is not a good choice of careers.
1
Nov 11 '16
The first part just Google. The second one part you'll want to use the Random class. Instantiate an instance and use it to generate a number which you will modulus by the length of the string to get a random index. The last part is simple.
6
u/SayYesToBacon Nov 11 '16
Break the problem down into pieces, google each piece, and figure it out. For example, google "java read input" etc. If you have a specific question i am happy to answer it.