C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
Bartleby Related Questions Icon

Related questions

Question

The Code must be in Java

 

Write a program to calculate the following for each integer from 0 to 35:

  • Print the current integer and one set of calculated values per line.
  • Calculate the following for each value from 0 to 35:
    • The square of the integer
    • The cube of the integer
    • The Fibonacci Number which occupies that integer’s position in the Fibonacci number sequence

Given that the first few numbers in the Fibonacci sequence are 1, 1, 2, 3, 5, 8, 13 and 21, for the integer 6 the output would be “6   36        216      8”.  Print a header or title line for the table to show what each of the columns represents (abbreviate “square” to “sqr” for simplicity.) The table headers and numeric output should line up nicely.

You must write the Fibonacci series part of the assignment with an ArrayList.  The point of this exercise is to practice with ArrayLists.  Everything you need to know about ArrayLists to do this was in the lecture and slides.  The other parts are simple multiplication operations. You shouldn’t use ArrayLists for them-just for the Fibonacci Sequence.  Create and fill the ArrayList first and then use a loop to generate the output.

Once you have the program running properly, add the necessary code to it to send the output to a file named “Lab10.out.txt” on the computer.

If you were to put the output of this program in Notepad, it may not appear to line up properly even though it lines up nicely in the Eclipse console. This warning is not telling you to submit the output. 

Do not create a Class to hold all the data. You are only using most of it once, so create the ArrayList of Fibonacci numbers and then just calculate the other values as you print them

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT