Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

In the Owl Project how do I incorporate "int numOwlsRacingToday = CONSOLE.nextInt();"?

+5 votes
I've completed the animation and got it to race ONE owl, but I can't figure out how to make it ask for the next owl to race. After it finishes the first owl's distance trial it terminates and doesn't ask for the next owl. Also I'm given a message in regards to the "int numOwlsRacingToday = CONSOLE.nextInt();"part that says "The value of the local variable numOwlsRacingToday is not used". So what would be the next step, or where am I supposed to put this part of the code?
asked Sep 3, 2017 in CSC 211 (F17) by Alex Versendaal (100 points)

1 Answer

0 votes

1) To see how to get the name of each owl from the user, carefully read through the example code in the KeyboardInputDemo.java file.

2) Eventually you'll want to have the user enter a number (perhaps 5), and then have that many owls race (e.g. 5 owls).  

Probably right now your program IS asking the user to type in that number, and then that number gets stored into the numOwlsRacingToday variable, but you aren't actually using that variable anywhere later on in your program.  At some point, the value of that variable should control how many owls actually do the racing.

answered Sep 4, 2017 by Forrest Stonedahl (100 points)