Type: Posts; User: penguinCoder
Search: Search took 0.01 seconds.
- 02-13-2013, 11:57 PM
Can ANY loop be translated into a recursive method? And can ANY recursive method be translated into a loop? Is there any scenario where one wouldn't be able to handle what the other can?
- 11-17-2012, 03:12 AM
You only need an array of 10 that will accept an infinite amount of inputs. All you need to do is just:
arrayOf10Name[userInput - 1]++;
This will store then number of occurances to the...
The best hint I could give you without giving to much of it away, would be to use something like:
char wordArray = word.toCharArray();
This will transfer you String word, into a character...
I believe that you are going to have to start by using a single loop and a single comparison to find the largest occurances number. And then from there, you would be able to start displaying them...
The easiest way I see for displaying the horizontal histogram, would be to loop a space one less then the index, and then at the end of the loop display a star. Something along the lines of that.
Well, obviously you are going to need an array of integers with a 100 different indexes. The easiest way to load that array is going to be using the following method:
X = one of your numbers
Just break it down into more manageable sections. Rather then thinking about the entire project, think of it as four parts.
A)Gather input from the user
Using println() methods and the Scanner...
What did you have completed? Do you know how modulus works?
I can help you with the code, but I'm not going to write it all for you.
Hint: It involves modulus and the base of the number format you are using...
Even if the common case were to be between 0-10, it would still have to calculate 2 comparisons, which would be even with how it was written. In the worst case scenario, instead of doing 7...
- 10-18-2012, 08:26 PM
The NewBoston has one episode that is dedicated to Downloading and Running Eclipse. It doesn't go over a lot of advanced features, but it does cover everything that a beginner needs to know to be...
If it wasn't static, wouldn't you need some kind of keyword before it; super, this, objectName, etc?..
- 10-18-2012, 04:33 AM
You really need to choose a type of formatting and just stick with it throughout the code. It seems like you change styles about 5 different times.
You do this for part of it:
for(int c = 0;...
I like optimizing code far more then answering questions, so let me start off with some techniques that would let you optimize the code you have written.
Where you have:
if(mainChar == 'A' ||...
It appears to be calling a static method with the parameters x and 3. It should display "Blah = [whatever the method returns]"
Thanks for the response. I used the 'contact us' link at the bottom of the page in an attempt to contact the webmaster directly. I will post the response I get from him/her below for future members.
So this problem was brought up 3 months ago yet there is still no official answer as to why, besides that of guess work. Should I take that to mean that this problem is not going to be addressed?
For some reason I am not able to post either a Avatar or a Profile picture..
I have a picture that is 100x100 pixels, that has a size of 15.1kb. It appears to be within the requirements of:
- 10-17-2012, 05:30 AM
It is what our teacher tells us about once a week.. Mind giving me an example, excluding recursion, of where they would be needed? Where regular code would not suffice... Or a link.
- 10-17-2012, 05:21 AM
I can see how it could be cut down, but to a single line of code?.. Would you mind illustrating this, via a post or pm? I would like to see how, for my own personal knowledge...
5 lines is the...
First off, you should really wrap up your code in
tags so that it is much easier to read.
- 10-16-2012, 04:45 AM
Couldn't you just store the points in an array and then just pass the array to the next method via the parameters?
First, I must say that I am not an expert at recursion, so there may be a better way of doing this then how I provide. This will however accomplish what you are trying to do, hopefully:
If you are just using 'y' and 'n', why not just use the type 'char'? It seems like you are wasting a byte of memory for nothing..
You will soon learn that there is just about an infinite way of writing things. Java is an object-orientated language, yet if you want, you will never need to use objects. If you want you will...
Results 1 to 25 of 83