Avery Torres

Greenhorn
+ Follow
since Dec 15, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Avery Torres

I believe the whole problem is coming from wanting to read and write the same file without having ever saved it. There are many ways to get around this one may be using a RandomAccessFile.
11 years ago
I'm not sure where you are getting your info from but here are some links that might help you out. They explain pointers and their function in the java language better than I could.

http://cslibrary.stanford.edu/106/
http://www.sourcecodesworld.com/articles/c/pointers-and-memory/java.asp

Check those out and maybe other questions will arise after reading.
11 years ago
Here is a visual representation that maybe will clear things up:

(Bicycle ((MountainBike)(RoadBike)(Any other subclass))

So what this is trying to convey is that MountianBike and RoadBike are subsets of Bicycle. Everything that Bicycle has will be in both MountianBike as well as RoadBike. But on another note MountianBike and RoadBike may have different components (both variables and methods) inside of them that are only available to them. Its the same thinking as there are many birds(Bicycle class), but different birds have different traits and functions. There are birds that can fly like a robin and there are birds that cannot fly penguin.

So, bike01 comes only with the methods and variables that are defined in the Bicycle class.
bike02 comes with the methods and variable that are available to the MountianBike class as well as the Bicycle class.
And bike03 comes with the methods and variable that are available to the MountianBike class as well as the Bicycle class.

Everything would be inherited from the super class, not dropped off.
11 years ago
It looks like you are making an array of size 10, so it will never be able to hold more than 10 items(not sure if that is a problem or not).

What you need to do is have a variable that keeps track of how many items the user has added because right now your loop is trying to go through the entire array of size ten even if ten items have not been added.

Another thing you may want to think of is it track that the item being added is at least of size 2 and if it is smaller to either not use the value or return something like "A.A. A" AKA just repeat that one character instead of have a Index Out of Bounds Exception.
11 years ago
Take out all of your close System.in statements, ie "sc.close()" and "f.close()". Should work like a charm from there, also you might want to type check so that there is a catch in the menu if the user inputs a noninteger so that it doesn't just crash.
11 years ago