5 Questions in java

Nov 5th, 2014
Computer Science
Price: $25 USD

Question description

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.


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


        {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 

Tutor Answer

(Top Tutor) Daniel C.
School: UC Berkeley

Studypool has helped 1,244,100 students

Review from our student for this Answer

Nov 7th, 2014
"Thank you, Thank you, for top quality work, this is your guy!!"
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1831 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors