Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

trying to print histogram i scatched my last one and started over still stuck  RSS feed

 
Jonothon Turner
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

getting compile error
for (int j = 0; j <count; j++ )
cannot find symbol variable count
also truing to get this to ask user for int and print out
Enter a value to plot: 4

Enter a value to plot: 5

Enter a value to plot: 5

Enter a value to plot: 4

Enter a value to plot: 5

Enter a value to plot: 9

Enter a value to plot: 0

1 |

2 |

3 |

4 | ##

5 | ###

6 |

7 |

8 |

9 | #

10 |
any help will be greatly appreciated it has been along time for me i used to do java a long time ago and now starting to go back to school i feel like i am brand new again
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cannot find symbol variable count 

Where is the variable: count defined?  The compiler can not find its definitiion.

Note:  The variables named: count1 through count10 should be defined as an array, not as individual variables.
 
Jonothon Turner
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there an example i can see what you are talking about
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
an example i can see what you are talking about

Your other thread used an array: nums to count entered  values.  See line 13

http://www.coderanch.com/t/668096/java/java/stuck-create-historgram

Use the code in the first part of that thread to collect the numbers.
Rewrite the second part of the code to print one line for each element in the array.
For the first attempt, print the number, the | and the count.

When that works, work on the code to replace the count with a row of #s
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!