Kirstie Fran

Ranch Hand
+ Follow
since Feb 16, 2011
Kirstie likes ...
Android Mac OS X
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kirstie Fran

Bear Bibeault wrote:What kind of GUI? Swing? Web?

Regardless, it's not going to be that simple. Depending upon which type of GUI you choose, the method of accepting input will change drastically from reading in from the console.


it would be a swing gui. I'm using a jframe.
11 years ago
Hello,
I have simple digital root calculator program that i would like to add a GUI to; rather than create a whole new program, someone suggested that i simply wrap the old one in a GUI. any suggestions on how to do this?
Here is the original program:
11 years ago

Carey Brown wrote:Consider a HashMap<String,Integer>.


Can i get some help with implementing that please?
Where should i put it? I already have two methods, one to open the file and create a tree form it, the second is to sort it with an InOrder traversal. I'm thinking to place it after the second method, at the end.
How do I link it to the tree so that it can search it?
Lets say i were to use something like this:
11 years ago
I have some code that creates a binary search tree with the words from a .txt file. I have a tree created already called searchTree, I want to count the frequency of each word placed in the Tree and am creating a new tree as i go along.
The idea is that, if the word is not already in the tree, add it and set the count to 1, else dont add it again, just increase the count.


My output looks like this:

I think it's my method for checking if the Wrd is in the tree, because i'm having some trouble writing it.

any suggestions about where i may have gone wrong?
11 years ago
I have just commented out the line causing me confusion until i can speak to the professor in person about its origin and meaning.
What I need to now is to count the frequency of individual words in my BinarySearchTree of words.
The tree has been completed, then it was sorted InOrder.
To check the tree, I inserted "System.out" statements in there to ensure that the tree was populated then sorted correctly. So i know everything is in there.

My question is: at what point should I create a method to count the frequencies?
As the tree is being populated? before the tree is sorted with an InOrder traversal? or at the very end, when everythin is already in order?
My search has yielded examples of people using maps and all sorts of other methods, but I must use the BST and make the best of the situation.

My end result should run along the lines of:
11 years ago
What I refered to before is some starter code that is was given, that element is unknown to me and i cant find any literature on it so i thought someone on this forum might be able to help me.
The idea is this:
I have a text file which I must use to create a binary search tree. I know how to create the tree and populate it. My question is about accessing the file. It needs to be accessed and read line by line. I would like some suggestions about where I should place the .txt file in relation to the program folder. I would also like some help in actually accessing the file, pointing the pogram to the proper path to find it.

If anything else is unclear, let me know.
11 years ago
As I said in the first line, I'm trying to access a .txt file to read its contents. How do i tell the program where to look for the file; access it?
11 years ago
I'm writing a program that will read a .txt and create a binary tree using the data it gathers from it.
I am having some trouble pointing the program to the file.



it keeps asking me for the file everytime, but i can't seem to write it into the code. The file will likely be in the same project folder, if not in the same folder as the main project folder. or should i place it in a particular folder within the project?
11 years ago
Ok, I see what you mean; that makes sense.
12 years ago

Kirstie Fran wrote:
Line 15 also gives this error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 46


I modified line 14: for (int i = 0;i<46; i++)
and have eliminated that error
12 years ago
This is what i have for the maths:

My output looks like this: 30, 29, 28, 26, 23, 18, 10,


Line 15 also gives this error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 46
at Program.main


Where did i go wrong?
12 years ago

Dennis Deems wrote: I don't think a formula will be nearly as useful as writing out verbally what needs to happen.



Ok, thanks. I was thinking about doing that, but since the professor provided the formula, i wanted to understand what it was about.
12 years ago
I just need one combination for each sum. I already have a formula, but am having trouble understanding the different components.
Rather than the standard:
f(n)= f(n − 1) + f(n − 2)

I have:
n=f(j)+(n-f(j))

What is j?
12 years ago
Hello,
I'm trying to write a program that gives the user the Fibonacci sum of a given number. can i get some help with the formula to do this? Before you answer, i already know how to get the Fibonacci Series, but that isn't what i need. When the user gives a number, the program finds the appropriate combination from the Fibonacci series to give that number.

example:
input -->30
output --> {1,8,21} {1,3,5,21} {1,3,5,8,13}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input -->50
output --> {3,13,34} {1,2,13,34} {3,5,8,34} {1,2,5,8,34} {3,5,8,13,21} {1,2,5,8,13,21}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This link will show you what i mean.
http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibrep.html

Let me know if this is in any way unclear.
12 years ago
yes, i have found a few explanaitions online, but they are fairly involved, and i'm not sure if i can convert it all into coharent code.

http://mathworld.wolfram.com/Circle-CircleIntersection.html
12 years ago