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
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 6 images
- Computer Engineering labarrow_forwardLanguage: JAVA Leap-Year Write a program to find if a year is a leap year or not. We generally assume that if a year number is divisible by 4 it is a leap year. But it is not the only case. A year is a leap year if − It is evenly divisible by 100 If it is divisible by 100, then it should also be divisible by 400 Except this, all other years evenly divisible by 4 are leap years. So the leap year algorithm is, given the year number Y, Check if Y is divisible by 4 but not 100, DISPLAY "leap year" Check if Y is divisible by 400, DISPLAY "leap year" Otherwise, DISPLAY "not leap year" For this program you have to take the input, that is the year number from an input file input.txt that is provided to you. The input file contains multiple input year numbers. Use a while loop to input the year numbers from the input file one at a time and check if that year is a leap year or not. Create a class named LeapYear which will contain the main method and write all your code in the main…arrow_forwardfngdndndnn n dnnndnfnfnarrow_forward
- Edit question Write a Java program in java eclipse ide Generate 35 “even” random integer numbers in range [1000, 9999], display these numbers in 4 lines - display 10 numbers per line (10x3=30), display the remaining numbers (5) in the last line Find the maximum and the minimum numbers from these 35 even numbers. Display these 2 values. Find the average of these 35 random numbers. Display average value.arrow_forwardpython3 problemarrow_forwardExercise 2: The Hogwarts School of Witchcraft and Wizardry welcomes you! First-year students must go through the annual Sorting Ceremony. The Sorting Hat is a talking hat at Hogwarts that magically determines which of the four school Houses each new student belongs most to: Gryffindor Hufflepuff Ravenclaw ● Slytherin Your task is the following: Write a sortinghat.cpp program that asks the user some questions and places them into one of the four Houses based on their answers!arrow_forward
- Using Java programmingarrow_forwardSevens rule, zeros drooldef seven_zero(n):Seven is considered a lucky number in Western cultures, whereas zero is what nobody wants to be. We now bring these two opposites briefly together with positive integers that consist of some solid sequence of sevens, followed by some (possibly empty) solid sequence of zeros. Examples of such integers are 7, 77777, 7700000, 77777700, or 700000000000000. A surprising theorem proves that for any positive integer n, there exist infinitely many integers of such seven-zero form that are divisible by n. This function should return the smallest such seven-zero integer. This exercise is about efficiently generating all numbers of the constrained form of sevens and zeros in strictly ascending order to guarantee finding the smallest working such number. This logic might be best written as a generator to yield such numbers. The body of this generator consists of two nested loops. The outer loop iterates through the number of digits d in the current number.…arrow_forwardBinary numbers need more places for counting because: A. 0's and 1's can be added in front of them B. 0's and 1's have to be properly placed C. They are always big numbers D. Binary base is small E. None of the abovearrow_forward
- JAVA Based Prgmarrow_forwardPython Programming TasksQuestion 3Businesses some time market their contact no as: 111-GET-SONY. This technique makes easy for the customers to remember the brand name. To do so they use the alphabets that are printed on the numbers on dial pads of Tele/Mobile phones as follows: A, B, andC = 2D, E, and F = 3 G, H, and I = 4 J, K, and L = 5 M, N, and O = 6 P, Q, R, and S = 7 T, U, and V = 8 W, X, Y, and Z = 9. However, the telecom systems needs proper numbers for dialing. Create anapplicationthatshould prompt the user to enterthe no in specified format such as XXX-XXX-XXXXand then translates the number to their numeric equivalent. Input: 111-GET-SONYOutput: 111-438-7669 Question 4Write a program imitating a website where users can signin/signup, view certain information which can only beseen by signed in users, logout or exit the application.Initially you would have asequence userswithfollowing structure:users =…arrow_forwardC - Right Facing Anglearrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT