Question
Unit 10 Free Response Write two methods : Parts A and B are not related and do not rely on each other Part A -
Unit 10 Free Response
Write two methods :
-
Parts A and B are not related and do not rely on each other
Part A - The method printNums has two parameters: value and numRounds. The method will iterate for numRounds rounds. In each round, random integers between 0 and 9, inclusive, are generated and printed on a single line until value is generated. At that time, value is printed and the round stops. Values for the next round are printed on the next line of output.
For example, a call to printNums(5, 4) could result in the following output. Each round stops when 5 is printed for a total of four rounds.
325
7884465
06165
9678971145
public static void printNums( int value, int numRounds ) {
}
Part B - The method has no parameters. It reads input from the keyboard. The first line of input is a single number N (N >= 1). Then follows N lines, each line consisting of a single word (you may assume all words contain only lowercase letters). Output should consist of N lines with each line being the number of vowels (a, e, i, o, u) in the word on the corresponding line.
Sample Input Sample Output
3
elephant 3
aisle 3
ooooo 5
public static void countVowels( ) {
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started