Question: 2) A histogram is a graphical representation of data, where the area is proportional to the frequency of a variable and the width is equal

2) A histogram is a graphical representation of data, where the area is proportional to the frequency of a variable and the width is equal to the class interval. We want to write a module that takes a value n, and a character c, and displays the character in c, n times. Write both iterative and recursive versions of the function to display the value n, followed by n character c's on the screen horizontally. E.g. 1. calling the function with the number 10 and character '=' as arguments will display: 10 ========== E.g. 2. calling the function with 3 and '*' as argument will display: 3 *** a. write the C++ or Java code implementation code for both the iterative and recursive solutions for this problem b. demonstrate the use of both algorithms in a complete program. i.e. Create a main method that will prompt the user for a number and a character and call both methods to display each histogram.

Step by Step Solution

3.41 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a solution in Java that includes both iterative and recursive implementations for displaying ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!