This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of React Cookbook: Recipes for Mastering the React Framework and have David Griffiths & Dawn Griffiths on-line!
See this thread for details.
Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!

Carey Brown

Saloon Keeper
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
Forum Moderator
Carey Brown currently moderates these forums:
Colorado, USA
Cows and Likes
Cows
Total received
71
In last 30 days
0
Total given
6
Likes
Total received
1523
Received in last 30 days
25
Total given
242
Given in last 30 days
4
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

You have:
you should do away with this "currentGold" variable and any time you want to know how much gold you have use "amazon1.getGold()".
19 hours ago
Start with the largest denomination, "toonies", and find out how many times the required change is divisible by that. Compute the remaining required change.
1 day ago
Good. What you've posted won't compile though because you're missing a '{'  '}'. You may have just dropped it by mistake when you cut and pasted the code into the post.

So, make sure you get it to compile. Make sure it runs without any errors. Note that when you run it it won't actually do anything because you have noting inside the main() method. If you want to see it do something you could add this inside of the main() method:

Then get it to compile and run again.
1 day ago
2 days ago

2 days ago
The nodes themselves should never be accessible external to DoublyLinkedList so nobody else needs to know about the dummy head and tail nodes.
2 days ago
Yes, but the storage required is minimum because their "item" references will be null.

Doing things this way means that you don't have special cases for head and tail conditions, linking and unlinking are implemented uniformly.
2 days ago

Carey Brown wrote:Thanks Les, I hadn't taken it to the next step. Much cleaner.

As Les mentioned, if head and tail are Node's instead of Node references the above method works and is very succinct. The constructor would initialize them like this:

3 days ago
3 days ago
The OP made several edits to the code he posted and then eventually deleted. Line 35 originally read:
Edits should be forbidden once people have responded. Now the whole context is gone.
4 days ago
There's a "for" loop and a "repeat-until" loop. NEVER MIND - You edited your post. Tsk.
5 days ago

5 days ago
Just a reminder that this is what you were trying to fix. You have to change the get()s on the left side of the "=" to a call to set().

5 days ago