Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

Ex 7.8 Write Java statements to accomplish each of the following tasks:a) Display the value of element 6 of array f.b) Initialize each of the five elements of one-dimensional integer array g to 8.c) T

Ex 7.8 Write Java statements to accomplish each of the following tasks:

a) Display the value of element 6 of array f.

b) Initialize each of the five elements of one-dimensional integer array g to 8.

c) Total the 100 elements of floating-point array c.

d) Copy 11-element array a into the first portion of array b, which contains 34 elements.

e) Determine and display the smallest and largest values contained in 99-element floatingpoint array w.

Ex : 7.17 (Dice Rolling) Write an application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent..

Ex : 7.29 (Fibonacci Series) The Fibonacci series

0, 1, 1, 2, 3, 5, 8, 13, 21, …

begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two

preceding terms.

a) Write a method Fibonacci (n) that calculates the nth Fibonacci number. Incorporate

this method into an application that enables the user to enter the value of n.

Show more
  • @
  • 22 orders completed
ANSWER

Tutor has posted answer for $10.00. See answer's preview

$10.00

** ** Write **** ********** ** ********** **** ** *** following tasks:a) ******* *** value ** element * ** array *** Initialize each ** the **** elements ** *************** ******* ***** * ** *** Total the 100 ******** ** ************** ***** *** **** 11-element ***** * **** the ***** ******* ** ***** * ***** ******** 34 ********** ********* *** display *** ******** *** ******* ****** ********* ** ********** floatingpoint ***** w Solution *** ***************** **** **** ***** * * { * 8 * * * ****** ***** *** * new *********** float sum = ** ******* ****************** *** * sum * ***** ********************** * " + ********* *** **** * * 44; * ***** 11; **** * **** * *** * **** * for **** * * ** * **** *** **** * **** * ***** ***** ******* w * *** ********** ****** the ***** ***** **** ******** number ***** ******** * ***** ***** largest * ******* *** **** * = 0; i **** 99; i++) * ** ********* > w[i]) * ******** * w[i]; * ** (largest **** ***** * largest = ***** * } Systemoutprintln("Smallest * * * ********** ************************* * * * *********** * 717 ***** ******** Write ** *********** to ******** *** ******* of two dice The *********** ****** *** ** object ** class ****** **** ** roll *** ***** *** *** again ** **** *** ****** *** *** *** ** the two ****** should then ** ********** **** *** *** **** an ******* value from 1 ** 6 ** *** sum ** *** ****** will **** **** * ** ** **** 7 ***** *** most ******** *** and 2 and ** the least frequent Solution ********* ***** RollingDice *** public ****** void ************* ***** *** // ********* *** arr[] * *** int[11];  ** ******** ****** ** **** ****** ******** ***** *** (int * = ** i **** ********* **** * *** sum * *********** // ******* the ****** RollDice ** calculate ** the sum ** **** ** ** ** ******* *** *** in array * arr[0]++; * **** ** **** ** 3) * arr[1]++; } **** ** **** ** 4) * arr[2]++; * **** ** **** ** ** * ********* * **** ** (sum ** ** * ********* * **** ** **** ** ** * arr[5]++; * **** ** (sum ** ** { arr[6]++; } **** ** (sum == 9) * ********* * else ** **** ** *** * arr[8]++; * **** if **** ** *** * ********* } **** ** (sum == *** * ********** * * *************** } ******* ****** **** *********** ******* int count = ** *** **** j * 0; * **** 6; j++) * *** **** k * ****** * **** * + j; **** * **************** * * ******** } ******************* ******** * *** ****** static *** ********** * int dice1 * ***** ************* * 6 + 1); ** ******* **** to ******** ** ****** ****** *** ***** = ***** (Mathrandom() * * * *** int *** * ***** * ****** ** ****** *** ****** ******* of **** the **** return **** ***********  public ***** RollingDice *** public ****** void main(String[] ***** *** ** variables *** arr[] * *** int[11];  ** Printing ****** ** **** ****** ******** ***** *** **** i * 0; * **** ********* **** * *** *** * RollDice(); ** Calling the method RollDice ** ********* // *** *** ** **** == ** ** ******* *** *** in ***** { arr[0]++; } else if **** == 3) * ********* } else if **** ** ** * arr[2]++; * **** ** **** == 5) * arr[3]++; * **** ** **** ** ** * ********* * else ** **** == 7) * ********* * **** ** (sum ** ** * ********* * **** ** **** ** ** * arr[7]++; } **** ** **** == 10) * ********* * else ** **** ** *** * arr[9]++; * else ** **** ** 12) * ********** } } display(arr);  * private ****** void *********** ******* int ***** * ** *** (int * = ** j < ** **** * for **** * = ****** * < * * ** **** * **************** * + ******** * Systemoutprintln(); ******** * *** public ****** *** RollDice() { *** ***** = ***** ************* * * * 1); // Rolling **** ** ******** ** ****** ****** int ***** = ***** (Mathrandom() * * * *** *** *** * ***** + ****** ** ****** *** ****** ******* ** **** *** dice ****** **** ************* ******* ******* 3001635 4001152 ******* ************** ******* ******* ******* ******* ************** ******* 4998917 ******* ******* ************** ******* ******* ******* 4000571 ************** ******* ******* 4000571 ******* ************** ******* 4000571 ******* ******* ************** * *** (Fibonacci ******* The Fibonacci ******* * * * * * * ** ** …begins with *** terms *** * *** *** *** property **** each ********** **** ** the sum of the ************ ******* ***** * method ********* (n) **** calculates the nth Fibonacci number Incorporatethis method into ** *********** that enables *** **** ** enter *** ***** ** ****************** ************************ class FibonacciNumber {  public ****** int ******************* ** *** *** * = ** *** * * ** int *** * ** *** ***** = ** ** (n ** ** * ****** ** * ** ** ** 2) { ****** ** }  ***** ****** ** ** * *** = * + b; * = b; * * sum; ******** * ****** **** }  ****** ****** **** ************* args) {  ********************** Nth Number ** fibonacci ********* ******* ** * new Scanner(Systemin); Systemoutprintln("Enter *** *** ********* ***** (!schasNextInt()) { Systemoutprintln("Please enter *** ***** ********* * *** n * scnextInt();  Systemoutprintln("Nth ********* Number: " + ******************** ********** ***** *** ****** ** fibonacci SeriesEnter the *** ********** fibonacci Number: **

or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question