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

  Case study harley-davidson

When Harley-Davidson implements RFID, it will likely use the technology to help manage its relationships with its main customers, which are the local dealerships that sell motorcycles and use replacement parts in their shops.

  Proposal about a personal leadership

Write a 3 pages a proposal about a personal leadership, the purpose of this project is to have an opportunity to be a leader, to see if we like being a leader or not, a chance to apply what learning about leadership, and if don’t like being a leader ..

  Draw a use case diagram for the carpark system

To enable salary deduction of charges, carpark administrators will have the ability to export charges for any billing period. The exported file must be in a format readable by the company's accounting software.

  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?

  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.

  How does nsi provide service desk support

Our clients, mainly teachers, are on deck for many hours a day, way beyond the capacity to staff a help desk phone line for 14 hours a day. CIS3008 - Information technology service management.

  Lego - case study

Case study on lego I want 10 slides for presentation if you have any question please ask me or any confusions and I want around 1700 words with the reference

  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:

  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?

  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.

  Case study of the business of your choice

This assessment requires you to identify and describe a notable example of business invention, entrepreneurship, or innovation of an existing business of your choice.

  Intergroup relations-experiencing subtle racism

What social issue are you discussing and how will you defend this statement - Defend the usefulness of this theory - write a paper that integrates concepts and ideas discussed in the lectures.

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