How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask John Your Own Question
John, Engineer
Category: Homework
Satisfied Customers: 798
Experience:  Bachelors Degree
Type Your Homework Question Here...
John is online now
A new question is answered every 9 seconds

Question 1Write a recursive method nmbDigits which takes

This answer was rated:

Question 1

Write a recursive method nmbDigits which takes an integer value as parameter and returns the number of digits of the parameter value (for example nmbDigits(2054) is 4). Write a driver program to test the method. In the driver program, ask the user to enter an integer value, invoke the method (passing the entered value as parameter) and display the result.
Note. If an illegal value is entered, a message should be shown and the user will be required to enter a correct value.

Hint: Divide the number by 10 and count for how many times you can do that.

Question 2

Consider a method which calculates and returns the arithmetic mean of an array of integer values.

a) Design and implement meanIter, the iterative version of the method.

b) Design and implement meanRec, the recursive version of the method.

c) Write a driver program to test the two methods. Consider an array of size 20 populated with random integer values in the range 1 .. 99. Invoke the two methods and display the result.

For the recursive method, try to deduce a recurrence relation between meanRec(n) and meanRec(n-1).
Start from meanRec(n) formula (consider an array a of size n)
meanRec(n) = (a[n-1] + a[n-2] + … + a[0]) / n
and organize the right side of the above assignment statement to highlight there the expression of meanRec(n-1) which is: (a[n-2] + a[n-3] + ... + a[0]) / (n-1).

Submission requirements
Your completed assignment consist of the and files.

thanks for using

I will help you

when is due this
Customer: replied 3 years ago.

In less than 30 minutes.


only 30 mts,
Customer: replied 3 years ago.



Customer: replied 3 years ago.

Thanks. Let me know if you need any other information.


not yet
Customer: replied 3 years ago.



My name is John

Download the answer links from below

Hope this helps

For your future questions , Please post your questions starting with "For John"
If you need any changes, ask me before rating this ,Otherwise rate my answer as "Excellent"

John, Engineer
Category: Homework
Satisfied Customers: 798
Experience: Bachelors Degree
John and other Homework Specialists are ready to help you
Customer: replied 3 years ago.

Hi, can you tell me how to add a message if the user doesn't enter an integer value in Thanks.

i will add the code
Customer: replied 3 years ago.



You need to spend $3 to view this post. Add Funds to your account and buy credits.