Consider array size 20 populated with random integer values

Assignment Help Case Study
Reference no: EM13313096

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 examplenmbDigits(2054) is 4). Write a driver programTestDigits.java to test the method. Ask the user to enter an integer value then invoke the method passing the entered value as method parameter. 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 Test MeanVal.javato 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.

Hint: For the recursive method, try to deduce a recurrence relation between meanRec(n)and meanRec(n-1)starting from meanRec(n)formula (consider an arrayaof sizen):

meanRec(n) =(a[n-1] + a[n-2] + ... + a[0]) / n

You should 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).

Reference no: EM13313096

Questions Cloud

Find the speed of a satellite in a geosynchronous orbit : Communications satellites are placed in a circular orbit where they stay directly over a fixed point on the equator as the earth rotates. find the speed of a satellite in a geosynchronous orbit
How many extractions are required to decreases concentration : How many extractions are required to decrease the concentration of phenol below 100 mg/L in a wastewater containing 2000 mg/L of phenol if an ether-to-watewater ratio of 0.2 by volume is used in each extraction
Making process normally used by you and family member : What is the decision making process normally used by you and family member? Is there one person responsible for the new line of clothes or accessories due to their experience and skill set, or are decisions mutually agreed upon?
What is the power delivered to the proton by magnetic field : A proton is accelerated from rest across a potential difference of 4V. What is the power delivered to the proton by the magnetic field
Consider array size 20 populated with random integer values : Write a recursive methodnmbDigitswhich takes an integer value as parameter and returns the number of digits of the parameter value (for examplenmbDigits(2054) is 4).
Simplex method step by step in algebraic : Work through the simplex method step by step in algebraic form to solve this problem. Work through the simplex method step by step in tabular form to solve the problem
Determine the volume flow rate of the water : A horizontal water jet impinges against a vertical flat plate at 25 ft/s and splashes off the sides in the vertical plane. If a horizontal force of 350 lbf is required to hold the plate against the water stream,
What is the velocity of the water at the exit for max lift : A suction device is being designed based on the Venturi principle to life objects in submerged water. The operating water temperature is 50C. The suction cup is located 1.3 m below the water surface, and the Venturi throat is located 1 m above the..
Compare and contrast the architectures of the two services : compare and contrast the architectures of the two services along with the intended use of each application.

Reviews

Write a Review

Case Study Questions & Answers

  Colonial broadcasting company case

Colonial Broadcasting Company Case, arbara Warrington, Vice-President of Programming at Colonial Broadcasting Company,  Warrington thought that Gold would probably try to sell to CBC a movie idea based on the true story of a young boy who overcomes a..

  Area of collection and insurance processing

How would Michele use her practicum experience to help her concentrate on improving her skills in the area of collection and insurance processing?

  Develop a set of own responsibilities objectives

Develop a set of own responsibilities and performance objectives and evaluate own effectiveness against defined objectives

  How you would design the next campaign

How could this segmentation be best utilised for direct marketing activity - is it a success, should it be used at all and how you would design the next campaign - would you do anything different?

  Determine whether the prosecutor has proved his case

What do vou look for to determine whether the prosecutor has proved his case? And what to determine whether the defense has proved her nice?

  Produce a fairly comprehensive product

The Technical Journal assignment for the Linux class is not a typical assignment and this document is certainly not a typical "template" to facilitate the assignment.

  Case study on burger king: promoting a food fight

What are Burger King's communication objectives for its target audience and with its focus on the "super fan," does BK risk alienating / isolating other customers? What are the implications of this?

  Find the coursework requirements

Each staff member can borrow up to 17 books, a postgraduate student 10 and undergraduate student 6. The limit for a member of the public is 6 books.

  Judge the extent to which the marketing plan at just us

From the case study, judge the extent to which the marketing plan at Just Us! is outdated. Propose two (2) ways that Just Us! could improve the customer experience and thus sustain future growth.

  Use a single blank line to separate code blocks

Do not identify yourself in your source code file. The system will maintain your identity and keep the process of reviewing anonymous. Upload the this file using the Submission Facility below, then proceed to completing reviews.

  Compare japan competitor and a u.s. competitor product

Firm has contacted you to participate in a focus group. The focus group will compare a Japan competitor product (J) and a U.S. competitor product (U) against China firm's product - compare a Japan competitor product (J) and a U.S. competitor produc..

  Enron case shared activity

Enron was the first nationwide natural gas pipeline network in the United States. As the company grew, executives shifted the company's primary focus from energy delivery and infrastructure to investing in the stock market.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd