Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 3: Calculating Eibonacci numbers. The Fibonacci series is famous mathematical and computer science algorithm. For one thing it can describe the growth of a
Problem 3: Calculating Eibonacci numbers. The Fibonacci series is famous mathematical and computer science algorithm. For one thing it can describe the growth of a rabbit population a) Create a class named Fib b) Create an instance variable named number c Create a constructor that has an argument which is an integer and hold the number your wish to calculate the Fibonacci series for. d) Assign the argument to number. e) Create a method named calcFib. It will not have an argument. f) Create three integer local variables named fold1, fold2, and foldNew. Set foldNew to O. Set fold1 and fold2 to 1. Create a for loop that runs from 0 to less than number h) Set for foldNew to fold1 plus fold2 i) Set fold2 to fold1; j) Set fold1 to foldNew; k) At the end of the loop return foldNew Create a class called FibTester (this should only have a main method) m) Import Scanner n) Create a Scanner object o) Prompt the user for the number for which they want to calculate the Fibonnacci value p) Get and integer and assign it to num. Create a Fib object using num as the argument. r) Call calcFib and print the result. (This can be done in one or two steps)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started