This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line!
See this thread for details.
Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization forum!

fred rosenberger

lowercase baba
+ Follow
since Oct 02, 2003
fred likes ...
Chrome Java Linux
Forum Moderator
fred rosenberger currently moderates these forums:
St. Louis
Cows and Likes
Cows
Total received
51
In last 30 days
0
Total given
19
Likes
Total received
1660
Received in last 30 days
0
Total given
51
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by fred rosenberger

Nobody here is going to do this for you.  1) you wouldn't learn anything. 2)  it would be unethical.  3)  it's probably a violation of your school's or business' code of ethics.

What we WILL do is help you write it.  Show us what you have.  We'll make suggestions and guide to to writing it yourself.
2 days ago
as a side note, using parallel arrays to store your information is generally considered bad form.  It's often quite complicated to ensure all your elements stay in sync.  Granted, a roulette wheel doesn't change much, so this is less of an issue, but keep this in mind for future project.  You'd probably be better served created something like a "WheelSlot" object.  It could contain a number, a color, and an "even/odd" flag (although granted, that is not hard to figure out), etc.
1 week ago

Campbell Ritchie wrote:I see you have the scammy form of roulette wheel with 0s on, as was banned in Britain decades ago.


I'm not sure where the OP is from, but sadly, in the U.S., wheels with "0" and "00" are the norm.  I don't gamble much anymore, but the only place I've ever seen a single "0" wheel was in Vegas, and it was used as a marketing tool/selling point of that casino.
1 week ago

Moe Jackson wrote:We are now to close to a universal quantum computer.


Are we?  I mean, they have been saying we are 10 years from flying cars for the past 60 years...
2 weeks ago
If you are asking what specific java construct to you...STOP.

Programming is 90% thinking, and 10% typing.  Before you start thinking about java at all, you need to have a good understanding of what the steps are.  Write them out in English or whatever natural language you prefer.  Break them down into smaller and smaller pieces, until a 10 year old child could follow them.

THEN start thinking about java.
2 weeks ago
Why does it have to be a regular expression?  Remember, not every tool is right or best for every job.
2 weeks ago
You shouldn't put all your code in a single method.  You want to separate responsibility.  For example, you could create a method that is passed an array, and then it prints all the elements.  Once you have that, you can then use it like a lego block to build a bigger program.  If you also create a method that sorts the array, then your main method becomes very simple:

print_array
sort_array
print_array

aside: one could argue you are not printing the sorted array.  You are printing out an element of the array as you work through sorting it
2 weeks ago
what does it mean to add together something like 246  and "true"?  conceptually that makes no sense.
3 weeks ago

Bill Platt wrote:It is my understanding the at outer loop * inner loop will cause the inner loop to iterate that number of times


Be careful with that...since a loop can use a variable as the limit, it is possible for an inner loop to run a different number of times on each iteration...


The first time through the outer loop, the inner loop won't run at all.  
The next time, the inner loop will run once, then twice...etc.
3 weeks ago
It's very important you learn to write clear, simple specs that explain what you want or need done.  

So you take the length of the first word in a string.  Now you want the space between each word in the final string to be the length of the first word in the source string?  For example:
"this is my string"

would become
"this    is    my    string"
?
and

"a short string" would basically stay unchanged?
3 weeks ago
I think we have a different definition of "predictable" and "unpredictable".

To me, unpredictable means that regardless of what information you have, it is IMPOSSIBLE to accurately name the next thing.  No matter how many times I spin a roulette wheel, I can only name the next number correctly 1 out of 37 or 38 times (depending on the wheel type)

Pi, sqrt(2), log(47)...whatever....for all of these, if i have the right information, I can with certainty tell you what the next number will be.

Paul Clapham wrote: the infinite number of unpredictable decimal places.


I think the very fact that you CAN calculate it means it is ABSOLUTELY predictable.  ;-)
What you want is a collection of all players.  Once they have all been entered, you can then loop through the collection, look at each one, and if she is injured, print her out, otherwise just skip her.
4 weeks ago
If you wrote the code you say you did, you should be able to change it yourself.  Regardless, nobody here will write your code for you. That's not what we do.  We will help you, but we expect you to do the work yourself.
1 month ago
When you are codinig, you should spend 90% of your time THINKING, and only 10% TYPING.  Never write a single line of code until you have a good idea in your head how you are going to solve the problem.

I generally start by writing out the steps I take in English, which is my native language.  Then I refine them, breaking them down into smaller and smaller pieces, making my description more and more detailed.  for this problem, it'd be something like this:

1)  get a number
2)  if the number is not a single digit
3)  add up all the digits in the number to get a new number
4)  return to step 2
5)  if it is a single digit, we're done.

Ok, so i look at that.  line 1 looks like it should be a method all to itself.  Based on the code sample you provided, i'd assume that's already done.
Now, lined 2-4 look like they should be a loop of some kind. Line 3 all by itself looks like it should be a method.

now I can see writing a method that has a loop to see if I have a single digit, and return that if so.  If not, I need to call another method that sums the digits.

So now I can break line 3 into individual steps.  It's a method all to itself, so it doesn't care about how many times I've tried, how long the result is, or anything. All it has to do is sum the digits in whatever number it is given.  Now I can code the method with the loop, or code this method.  Whichever way I go, I can write some temporary code as a harness to test the piece I'm working on.  Once I'm sure that piece works, I can then use it as I build the other pieces.

The idea is to separate out responsibility of tasks, so each method does one simple thing, does it well,  and can be easily understood.