Question 1write a recursive method nmbdigits which takes an

Assignment Help Application Programming
Reference no: EM13380068

Question 1

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). Write a driver programTestDigits.javato 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 implementmeanIter, the iterative version of the method.

b)Design and implementmeanRec, the recursive version of the method.

c)Write a driver programTestMeanVal.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 betweenmeanRec(n)andmeanRec(n-1)starting frommeanRec(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 ofmeanRec(n-1)which is: (a[n-2] + a[n-3] + ... + a[0]) / (n-1).

 


Submission requirements

Your completed assignment consist of theTestDigits.java and TestMeanVal.javafiles.

Reference no: EM13380068

Questions Cloud

1- prove that any relation schema with two attributes is in : 1- prove that any relation schema with two attributes is in bcnf.nbsp2- ra b c is a relation in bcnf. a is one of the
Part-11 what is the difference between interactive : part-11. what is the difference between interactive processing and real-time processing? 2. suppose a time-sharing
Design implement and test an object-oriented java program : design implement and test an object-oriented java program for processing single-variable polynomials represented as
Part 11 how many cells can be in a computers main memory if : part 11. how many cells can be in a computers main memory if each cells address can be represented by two hexadecimal
Question 1write a recursive method nmbdigits which takes an : question 1write a recursive method nmbdigits which takes an integer value as parameter and returns the number of digits
Project specificationerp project implementation atoledo : project specificationerp project implementation atoledo pizza company is planning to implement a new erp system. tim
1online bankingwhat special consequences do you foresee : 1.online bankingwhat special consequences do you foresee from information security breaches confined to online retail
Consider a class that could be used to play a game of : consider a class that could be used to play a game of hangman. the class has the following attributesthe secret wordthe
Define a class called counter an object of this class is : define a class called counter. an object of this class is used to count things so it records a count that is a

Reviews

Write a Review

Application Programming Questions & Answers

  1 menu optionsthe shell script should generate a menu to

1. menu optionsthe shell script should generate a menu to allow the user to choose each option. after executing options

  Aussie best car abchas now decided to award an additional

aussie best car abchas now decided to award an additional bonus based on the bonus contributed by the sales of an

  Design a program that models the worms behavior in the

design a program that models the worms behavior in the subsequent scenarioa worm is moving toward an apple. each time

  Taskdesign and implement a c windows phone 8 application

taskdesign and implement a c windows phone 8 application based on the soundboard app in the windows phone 8 development

  Create a multi-threaded competition in which opposing robin

create a multi-threaded competition in which opposing robin hoods will attack one another and try to take each others

  Write an arm subroutine which will extract a substring from

write an arm subroutine which will extract a substring from a string. you will need to use the library routine malloc

  Produce a description of the modules you have studied so

produce a description of the modules you have studied so far on this degree in an html5 file and an external css file

  Use ruby on rials to design app video store will be your

use ruby on rials to design app video store will be your project it has to have a database and at least 4 pages style

  1 create a multi-view program for the iphonecreate a

1 create a multi-view program for the iphonecreate a program that involves multi-views. the main view should contain a

  Problemthe manager of the super supermarket would like to

problemthe manager of the super supermarket would like to be able to compute the unit price for products sold there. to

  Imagine that your company has decided to expand to the web

imagine that your company has decided to expand to the web. you want to reuse some data entry code that has been

  Assessmentthe project reports will be evaluated in three

assessmentthe project reports will be evaluated in three areasaccuracy and completeness of computationsyou have to get

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