This site requires JavaScript, please enable it in your browser!
Greenfoot back
ericnjaramba
ericnjaramba wrote ...

2018/10/27

input output question

ericnjaramba ericnjaramba

2018/10/27

#
i'm new to programming and i have a question about to go about this in Greenfoot. Create a Greenfoot program that will ask the user questions, process the answers, and output the appropriate data and calculations. Ask the user to input the number of singles, doubles, triples, and home runs (each asked individually). Call a method to calculate the number of total bases, where a single is worth one, a double worth two, a triple worth three, and a home run worth four. These values will be added together to get the final number of total bases. We created the logic for this in a previous written exercise. The output should be centered in the screen and look like this: Singles: n Doubles: n Triples: n Home Runs: n Total Bases: n
danpost danpost

2018/10/27

#
That looks like the whole assignment. What part are you having trouble with and what have you tried?
ericnjaramba ericnjaramba

2018/10/27

#
danpost wrote...
That looks like the whole assignment. What part are you having trouble with and what have you tried?
i have tried and the part im having trouble with is "Ask the user to input the number of singles, doubles, triples, and home runs (each asked individually)" ?
danpost danpost

2018/10/27

#
ericnjaramba wrote...
the part im having trouble with is "Ask the user to input the number of singles, doubles, triples, and home runs (each asked individually)" ?
You should check out the ask method of the Greenfoot class.
You need to login to post a reply.