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

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!