client threads
Budget: €8 – €30 EUR
CS380 Lab Assignment – Client Server & Threads Part 2
The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, ....
Formally, it can be expressed as:
f ib0 = 0
f ib1 = 1
f ibn = f ibn−1 + f ibn−2
Write a multithreaded Java program that generates the Fibonacci sequence. This program
should work as follows:
The user will be prompted to enter the number of Fibonacci numbers that the
program is to generate (e.g. System.out.println(“Please enter the number of
Fibonacci numbers that the program should generate: “);).
The program will then create a separate thread that will generate the Fibonacci
numbers, placing the sequence of numbers generated in an int array that can be
shared by the threads (tip: an array is probably the most convenient data structure –
i.e. int[]).
When the thread finishes execution, the parent thread will output the sequence
generated by the child thread. Because the parent thread cannot begin outputting
the Fibonacci sequence until the child thread finishes, this will require having the
parent thread wait for the child thread to finish.
[tip: last week’s thread reading material will help you to complete this part of the
assignment]
The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, ....
Formally, it can be expressed as:
f ib0 = 0
f ib1 = 1
f ibn = f ibn−1 + f ibn−2
Write a multithreaded Java program that generates the Fibonacci sequence. This program
should work as follows:
The user will be prompted to enter the number of Fibonacci numbers that the
program is to generate (e.g. System.out.println(“Please enter the number of
Fibonacci numbers that the program should generate: “);).
The program will then create a separate thread that will generate the Fibonacci
numbers, placing the sequence of numbers generated in an int array that can be
shared by the threads (tip: an array is probably the most convenient data structure –
i.e. int[]).
When the thread finishes execution, the parent thread will output the sequence
generated by the child thread. Because the parent thread cannot begin outputting
the Fibonacci sequence until the child thread finishes, this will require having the
parent thread wait for the child thread to finish.
[tip: last week’s thread reading material will help you to complete this part of the
assignment]