using java
This problem has you create a main() method plus two others: onethat will populate an array of random integers, the other to searchfor a specific user-supplied value and count the number ofoccurrences.In main(), declare an array that can store 500 integer values inthe range of 0 to 100.Create another method of type void() and call it from main(); usethis method to populate the array. In main(), ask the end user for a specific number to search for.Sample dialog:
Enter a number from 0 to 100 to search for: 89Create and call a value-returning method that passes the array andthe search value provided by the user. Then, in the method, countthe number of occurrences. Return the count to the calling method,main() for display, as shown in this example (assuming there were 7occurrences in the random set generated).
Note that the percentage needs to be calculated in main; use the.length property as denominator, the percentage for the numerator,and remember to multiply by 100 and avoid integer division:
Value 89 was found 7 times (1.40% of 500 values)
or if not found
Value 89 was not found in 500 values
using java This problem has you create a main() method plus two others: one that will populate an array of random intege
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am