Please Help! Unit 6: Lesson 1 - Coding Activity 2
Instructions: Hemachandra numbers (more commonly known as Fibonacci numbers) are found by starting with two numbers then finding the next number by adding the previous two numbers together. The most common starting numbers are 0 and 1 giving the numbers 0, 1, 1, 2, 3, 5...
The main method from this class contains code which is intended to fill an array of length 10 with these Hemachandra numbers, then print the value of the number in the array at the index entered by the user. For example if the user inputs 3 then the program should output 2, while if the user inputs 6 then the program should output 8. Debug this code so it works as intended.
The Code Given:
import java.util.Scanner;
public class U6_L1_Activity_Two{
public static void main(String[] args){
int[h] = new int[10];
0 = h[0];
1 = h[1];
h[2] = h[0] + h[1];
h[3] = h[1] + h[2];
h[4] = h[2] + h[3];
h[5] = h[3] + h[4];
h[6] = h[4] + h[5];
h[7] = h[5] + h[6];
h[8] = h[6] + h[7]
h[9] = h[7] + h[8];
h[10] = h[8] + h[9];
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
if (i >= 0 && i < 10)
System.out.println(h(i));
}
}
Answer:
John Mauchy 1. designed to be a stored-program computer 2. it was binary rather than decimal
Answers:
What is the index of the last element in the array? stArr1.length()-1
This prints the names in order. How would I print every other value? Change line 4 to: index = index +2
Change line 7 to: i < names.length
Answer:
By keeping track of file links and deleting them along with the files
Explanation:
when different users create different files with the same name, and one tries to open one of the files, the first file that is found on the VTOC of the disk will be opened. These problems can be avoided by tracking of all links to a file, and whenever there is a need to delete a file, the link to the file as well should be deleted.
The reason and why ejecta can affect short term climate is that Lower global temperatures by blocking incoming energy from the sun.
<h3>Why is it vital to decrease global temperature?</h3>
A warmer climate is known to often increases public health issues like heat illnesses and as such, it is vital to lower temperature.
Therefore, in the case above, The reason and why ejecta can affect short term climate is that Lower global temperatures by blocking incoming energy from the sun.
Learn more about ejecta from
brainly.com/question/9928957
#SPJ12