Computer Science 261
Assignment # 3
Due: Wednesday, Sept. 12
Purpose:
- To continue getting comfortable with the JCreator tools
- To use parameters in a Java program
- To use arrays in Java
Write a Java program which will accept a number as a program
parameter (in the same way as assigment #2 - see below for a reminder
on how to configure JCreator so that it prompts you for parameters),
and which will
- Create an integer array with that many elements (you may
assume that the parameter is an integer greater than 2).
- Fill the array with Fibonacci numbers. The first two elements
of the array should contain 1, any further element in the array
should be the sum of the previous two elements. The first six
elements in the array should, for example, be 1 / 1 / 2 / 3 / 5 /
8.
- Print the array on the console.
Please call this program Fibonacci.java and place it in your
handins folder.
Recall how to configure JCreator to use an argument list
- Choose Options from Configure menu
- Select JDK Tools -> Run Application -> <default>
-> edit
- Select Parameters, click Prompt for main function
arguments
Questions? Please ask!