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

  From the scenario, prioritize the attributes of golds reling

From the scenario, prioritize the attributes of Golds Reling's brand from the brand map presented in the scenario according to the attributes that you believe would be most important to the new tablet's target market. Provide support for your respons..

  Discuss critically infosys current and future strategy

Discuss critically Infosys current and future strategy. What advice would you give Kris Gopalakrishnan and KShop has resulted in information overload among staff. What operational measures would you suggest to overcome such challenges?

  Review tarmac business case for diversity

Review Tarmac's Business Case for Diversity and the Learning Resources. Think about Tarmac's approach to managing diversity and how it relates to organisational behaviour concepts and human resource processes.

  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.

  Ebay inc internet success or fairy tale

Read the case study "eBay Inc.: Internet Success or Fairy Tale? "and answer the question below,   Use the 2002 financial statement data to replicate the Meyer's report calculations that illustrate the conclusion based on the 2001 data reached in the ..

  Mintendo game girl case study

Which option delivers the maximum profit for the supply chain: Sandra's plan, Bill's plan, or no promotion plan at all? How does the answer change if a discount of $10 must be given to reach the same level of impact that the $5 discount received?

  Splash soft drinks case study

Splash Soft Drinks Inc. (SSD) has recently achieved sales that exceeded its expectations after it introduced a new beverage that was greatly welcomed by their customers. The company is currently considering opening a new plant to which some of the pr..

  Details of the task using tesco plc

Details of the task Using Tesco plc (www.tesco.com) as a case study, prepare a report of no more than 2,500 words that:

  What are the common manifestations of alcoholic cirrhosis

What are the common manifestations of alcoholic cirrhosis? Which of these are secondary to hepatocellular failure? Which are secondary to portal hypertension?

  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.

  Read natasha kingery case and answer the questions

Read the DATA CASE on pages 126-127 about Natasha Kingery who is considering furthering her education and is seeking financial advice. Determine the interest rate she is currently earning on her inheritance by going to Yahoo!

  Identify the relevant facts of the case study

Imagine you are the financial controller of XYZ Ltd a corporation that is a very large donor to HOHO. You have recently become aware that its TV advertising has resulted in the charity violating the 25% expenditure ratio for its charity drive.    Id..

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