Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: 3 questions

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 3 questions

    Question 1
    Write a thread that tosses a coin 1000 times and computes the frequency of heads and tails. A coin can be modelled by a random number generator that generates random numbers in the range 0..1.

    Question 2
    Write a thread that continuously prints a message every 100 milliseconds while it is still alive. The thread should be written in such a way that it can be terminated at any time by a control program (main).

    Question 3
    Write a program that employs 2 threads that each toss their own die (modelled by a random number generator that generates random numbers in the range 1..6) a given number of times. In both cases the result of each toss is stored in a shared array. The array is deemed to be large enough to store the result of every throw and each thread should only write to its own array segment. Once the threads have completed their work then the main program counts the frequency of each number thrown and prints it on the screen.

  2. #2
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: 3 questions

    So what's your question? And just so you know, will assist with homework but we won't write the code for you.

    Regards,
    Jim

Similar Threads

  1. little questions
    By bpe in forum Java Theory & Questions
    Replies: 3
    Last Post: September 19th, 2013, 03:52 AM
  2. questions
    By fahid in forum Java Theory & Questions
    Replies: 1
    Last Post: December 5th, 2012, 04:42 AM
  3. List of my Java3D Questions, and Proguard questions
    By Zachary1234 in forum Java SE APIs
    Replies: 0
    Last Post: November 16th, 2012, 09:40 PM
  4. Need help with some questions!
    By goha14 in forum Java Theory & Questions
    Replies: 6
    Last Post: March 27th, 2012, 08:01 PM
  5. [SOLVED] Some serious questions,
    By Time in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 17th, 2010, 02:52 AM