Java program
Hi all,
I have to write a very small java program but I am not good in Java . It would be great when someone could help me out. The question is:
Write a Java program that will print out statistics for N coin tosses. The user will input N first. And then the user has to input either 'h' or 't' for N times. The program will print the number of heads and tails and their persentages.
Sample output should be as follows:
Give N
10
GIVE 'h' or 't'
h
h
t
h
t
t
t
h
h
h
Number of 'h' is 6
Number of 't' is 4
Percent head is 60%
Percent tail is 40%
Thanks
MoD 2007
[751 byte] By [
MoD2007] at [2007-11-20 11:23:28]

# 1 Re: Java program
We'd be happy to help you out. What have done so far?
Also, when posting your code, please use code tags so that your code will be well-formatted and readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
[code]
// your code block goes here.
[/code]
# 3 Re: Java program
You need to ask a specific question. Please note: We don't teach Java and we don't do peoples homework.
Have you written out the steps (using pen and paper not code) that you need to take to answer the question? - it can sometimes help to pretend that you are the computer and the user is another person. Once you have this then writing the code is a lot easier and if you really have no idea how to go from this to code then post your sequence of steps and we'll go from there.
keang at 2007-11-10 2:16:06 >

# 4 Re: Java program
Hi petes1234,
thanks for your fast reply. The problem is that I don't know how to start to build the java program. It would be great when you can figure it out for me. I have realy no idea. Just give me a hint or something.As Keang stated, we don't do other people's work, and we can't study other people's lessons. Your best bet if you don't have a clue is to go through the sun java introductory tutorials. You can find them here (http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html).