The Artima Developer Community
Sponsored Link

Java Answers Forum
who can make the answer?

7 replies on 1 page. Most recent reply: Sep 28, 2003 6:13 PM by 1

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 7 replies on 1 page
1

Posts: 5
Nickname: hello88852
Registered: Sep, 2003

who can make the answer? Posted: Sep 27, 2003 6:36 PM
Reply to this message Reply
Advertisement
A group of people are betting on the outcome of three throws of the dice.A person bets $1 on predicting the outcome of the three throws.Write a program that uses the random number method to simulate three throws of a die and displays the winnings according to the following rules:
all three throws are sixes:win $20;
all three throws are the same(but not sixes):win $10;
all two of the three throws are the same:win $5
Thank you!


Kevin

Posts: 27
Nickname: quasi
Registered: Apr, 2003

Re: who can make the answer? Posted: Sep 27, 2003 8:41 PM
Reply to this message Reply
Do your own homework?
Here a little hint use Math.random

Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: who can make the answer? Posted: Sep 28, 2003 4:14 AM
Reply to this message Reply
I don't think except you should make the answer!

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: who can make the answer? Posted: Sep 28, 2003 7:37 AM
Reply to this message Reply
The source code for an applet that simulates the rolling of dice is at:
http://www.quantumhyperspace.com/SourceBank/viewCode.jsp?javaFile=DiceApplet.java

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: who can make the answer? Posted: Sep 28, 2003 10:36 AM
Reply to this message Reply
I was going to suggest that if you can't solve this programming problem, you change your major, but after reading "all two of the three throws are the same", I'm thinking maybe you should just drop out altogether...

Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: who can make the answer? Posted: Sep 28, 2003 5:34 PM
Reply to this message Reply
Setting aside the fact that this users ought to do his or her own homework...
Is there an efficient algorithm for comparing three (or more) values? There's an obvious brute force approach, but I was thinking there must be some elegant computer scientist type of approach.

-Joe

1

Posts: 5
Nickname: hello88852
Registered: Sep, 2003

Re: who can make the answer? Posted: Sep 28, 2003 6:12 PM
Reply to this message Reply
You're right.Now I have solved the problem by myself.I just wanted to communicate with you by this one.I don't like somebody's suggestion asking me to change the major in deed.

1

Posts: 5
Nickname: hello88852
Registered: Sep, 2003

Re: who can make the answer? Posted: Sep 28, 2003 6:13 PM
Reply to this message Reply
Thanks for your reply.Hope to meet you again next time.

Flat View: This topic has 7 replies on 1 page
Topic: Can not access class files in JSP Previous Topic   Next Topic Topic: JCA - Connection Pooling

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use