5 Questions in java

5 Questions in java

Hello !

I need answers for these questions : 

#1.  Write a method called mostFrequentDigit that returns the digit value that occurs most frequently in an integer number.

#2. A Random object generates pseudo-random numbers. Assume that we simulate rolling of two 8-sided dice until both are even. 

     Write a program by generating random numbers usingRandom object.   

          The expected output is:

            (7, 4)

            (1, 3)

            (8, 7)

            (1, 1)

            (1, 2)

            (7, 3)

            (8, 5)

            (4, 2)

           You won after 8 tries!

#3. Write a method, handleNumbers(int[] numbers), which prints both the last element and the middle element of any array, after sorting (either ascending or descending order) the array sent as a parameter. 

#4.Write a method, duplicateNumbers(int[] numbers), which is supposed to return a new array with two copies of each value.

      Input:

        {2, 4, 6, 8, 10, 12}

      Output:

        {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12}

#5.The conditional expression with three operands or the question mark-colon operator follows the following syntax.

 Condition ?Expressiontrue : Expressionfalse

By using the above conditional expression (required), please write a method called passOrFail() whether returns true when the grade is greater than equal to 70 otherwise false (4 pts).

  public static boolean passOrFail(int grade) {

  } // absoluteValue

Please look at the questions before you offer 

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper