Problem Description: Write a program that generates 100 random integers between 0 and 9 and displays...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem Description: Write a program that generates 100 random integers between 0 and 9 and displays the count for each number. *** Hint: Use an array of ten integers, say counts, to store the counts for the number of Os, 1s. ..., 9s. The program must then ask if the user wants to continue with another run. If the user enters "y", the program will start a new conversion. Otherwise, it'll stop. Sample run: (red indicates user's inputs) This program generates 100 random integers between 0 and 9 and displays the count for each number Number of 0s is 9 Number of is is 7 Number of 2s is 8 Number of 3s is 8 Number of 4s is 8 Number of 5s is 14 Number of 6s is 10 Number of 7s is 9 Number of 8s is 6 Number of 9s is 21 Continue? (y/n) ycenter icon> Number of Os is 10 Number of is is 4 Number of 2s is 7 Number of 3s is 16 Number of 4s is 6 Number of 5s is 12 Number of 6s is 9 Number of 7s is 9 Number of 8s is 11 Number of 9s is 16 Continue? (y/n) n<enter icon> Good bye! ***Notes: The count of each number can be different each time the program runs as the integers were generated randomly. 2. Maximum number (15 pts) Problem Description: Write a method that finds the maximum element in an array of double val- ues using the following header: public static double max(double[] array) Write a test program that prompts the user to enter ten numbers, invokes this method to return the maximum value, and displays the maximum value. The program must then ask if the user wants to continue with another array of numbers. If the user enters "y", the program will start a new conversion. Other- wise, it'll stop. Sample run: (red indicates user's inputs) Enter 10 numbers for the array, separated by spaces: 12 2.3 4.5 21.7 2 45.1 87.4 20.3 38 21.3<enter icon> The maximum element of the array is 87.4 Continue? (y/n) y<enter icon> Enter 10 numbers for the array, separated by spaces: 43.5 26.4 32.1 99 32.9 50.1 45 20.7 83.5 12.8<enter icon> The maximum element of the array is 99.0 Continue? (y/n) n<enter icon> Good bye! Problem Description: Write a program that generates 100 random integers between 0 and 9 and displays the count for each number. *** Hint: Use an array of ten integers, say counts, to store the counts for the number of Os, 1s. ..., 9s. The program must then ask if the user wants to continue with another run. If the user enters "y", the program will start a new conversion. Otherwise, it'll stop. Sample run: (red indicates user's inputs) This program generates 100 random integers between 0 and 9 and displays the count for each number Number of 0s is 9 Number of is is 7 Number of 2s is 8 Number of 3s is 8 Number of 4s is 8 Number of 5s is 14 Number of 6s is 10 Number of 7s is 9 Number of 8s is 6 Number of 9s is 21 Continue? (y/n) ycenter icon> Number of Os is 10 Number of is is 4 Number of 2s is 7 Number of 3s is 16 Number of 4s is 6 Number of 5s is 12 Number of 6s is 9 Number of 7s is 9 Number of 8s is 11 Number of 9s is 16 Continue? (y/n) n<enter icon> Good bye! ***Notes: The count of each number can be different each time the program runs as the integers were generated randomly. 2. Maximum number (15 pts) Problem Description: Write a method that finds the maximum element in an array of double val- ues using the following header: public static double max(double[] array) Write a test program that prompts the user to enter ten numbers, invokes this method to return the maximum value, and displays the maximum value. The program must then ask if the user wants to continue with another array of numbers. If the user enters "y", the program will start a new conversion. Other- wise, it'll stop. Sample run: (red indicates user's inputs) Enter 10 numbers for the array, separated by spaces: 12 2.3 4.5 21.7 2 45.1 87.4 20.3 38 21.3<enter icon> The maximum element of the array is 87.4 Continue? (y/n) y<enter icon> Enter 10 numbers for the array, separated by spaces: 43.5 26.4 32.1 99 32.9 50.1 45 20.7 83.5 12.8<enter icon> The maximum element of the array is 99.0 Continue? (y/n) n<enter icon> Good bye!
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that generates 100 random integers between 0 and 9 counts the occurrences of ... View the full answer
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
The Tech Software School contracts to train employees of companies in the use of various software products and packages. The training programs are all delivered on three consecutive days but require...
-
Design a cantilever beam to have minimal mass while maximizing stiffness. Design a 2 meter long cantilever beam of minimum weight for a deflection at the end of the beam not to exceed of 20 mm. The...
-
Rewrite Programming Exercise 7.7 using streams. Data from Programming Exercise 7.7 Write a program that generates 100 random integers between 0 and 9 and displays the count for each number. (Hint:...
-
John and Jane Darling are newlyweds trying to decide among several available rentals. Alternatives were scored on a scale of 1 to 5 (5 best) against weighted performance criteria, as shown in Table....
-
What are the assumptions of a correlated group T test?
-
What continuous uniform series of cash flows over 7 years can be paid out of a fund having $20,000 at the present (or time 0) if interest is 10 percent compounded continuously?
-
In 2020, Lambeau Inc. suffered a loss of \(\$ 100,000\). The enacted tax rate is \(25 \%\). Prepare Lambeau's entry for the loss carryforward on December 31, 2020, assuming that management determined...
-
Bob Vance is unable to reconcile the bank balance at January 31. Bobs reconciliation is as follows. Cash balance per bank $3,560.20 Add: NSF check 690.00 Less: Bank service charge 25.00 Adjusted...
-
The following data relate to the operations of Shilow Company, awholesale distributor of consumer goods:Current assets as of March 31:Cash$ 7,900Accounts receivable$ 21,600Inventory$ 2 answers
-
The smooth rod of mass M rests inside the glass. Determine the reactions on the rod. Given: M = 20 gm a = 75 mm b = 200 mm = 40 deg g = 9.81m/s2 b.
-
10.51 Investment Securities. You are engaged in the audit of the financial statements of Bass Corporation for the year ended December 31 and you are about to begin an audit of the investment...
-
Jackpot Mining Company operates a copper mine in central Montana. The company paid $1,950,000 in 2024 for the mining site and spent an additional $790,000 to prepare the mine for extraction of the...
-
List and describe the challenges that a global, virtual team must overcome to be successful.
-
Module: Qualitative Research - To determine the challenges faced by the automotive sector in the wake of the COVID-19 pandemic. a.) What effect has the coronavirus (COVID-19) pandemic had on the...
-
Selected data for Babar Ltd of past year of operations are presented below: Product X Production [ in units ] 4750 Sales [ in units ] 2800 Selling price $15.00 General activity [DL Hours] 5080...
-
1. What are the budget challenges New Jersey is facing? 2. What are the legal constraints of New Jersey (such as tax and expenditure limitations)?
-
Cawley Company makes three models of tasers. As evident, the Stunner is not generating a profit, so Cawley is considering dropping this model. Of course, if the model is dropped all of the revenue...
-
Define cultural intelligence. Cite the books or journal articles you found in Capella's library. Explain why cultural intelligence is important for HR practitioners and other organizational managers.
-
Use streams to write a program that displays the distinct scores in the scores array in Section 8.8. Display the scores in increasing order, separated by exactly one space, five numbers per line.
-
Write a program that enables the user to specify the location and size of the rectangles and displays whether the two rectangles intersect, as shown in Figure 16.39b. Enable the user to point the...
-
Write a program that prompts the user to enter the number of students and each students name and score, and finally displays the name of the student with the highest score. Use the next() method in...
-
Search for the latest about Robert Allen Stan- fords' alleged ponzi scheme.
-
From the following selected balances of Filo plc as at 31 March 2005 draw up (i) a detailed trading and profit and loss account for internal use, and (i) a profit and loss account for publication....
-
From the following selected balances of State plc as at 31 December 2008, prepare (j) a detailed trading and profit and loss account for the year ended 31 December 2008 for internal use and (ii) a...
Study smarter with the SolutionInn App