# data[].attributes.body
while counter is less than 5
random =  generate random()

for each number inside result array:
if random is greater than current number:
shift array one place to the right
add random to result array at current index

exit loop

else:
continue

counter + 1

# data[].attributes.headline
how to use java.util.Collection in question 9?

# data[].attributes.subject
how to use java.util.Collection in question 9?

# data[].attributes.body
initialize counter as 0
while counter is less than 5
generate a random number
add the number to a list
increase counter by 1

initialize counter2 as 0
while counter2 is less than 5
for every number on the list
if current number is more than next number
add current number to a separate list
increase counter2 by 1
else
add next number to the separate list
increase counter2 by 1

for every number in the second list
print number

# data[].attributes.body
Start

Female student = femaleStudent

Initial counter=0, femaleStudent=0

If counter is less than 100

Randomly generate a student with a gender (Male/Female)

Store the student in the list

Increase counter by 1

if there is female student, increase femaleStudent by 1

Print the number of femaleStudent

End

# data[].attributes.body
get a number from user as guess number
generate a random number

while the guess number is not equal to random number
if the guess number is greater than the random number
print too high
otherwise
print too low
get another number from user as guess number

Print you have made a successful guess

# data[].attributes.body
Start

U= characterU

M= characterM

Initial characterU=0, character M=0

Request sentence from user

If there is character U, increase character U by 1

If there is character M, increase character M by 1

Print the number of character U and M

End

# data[].attributes.body
1) initialize counter is 0, num1,num2,num3,num4,num4, randomnumber
2 ) counter must be less than 5
3) generate random number
4) random number = num1
5) if num1 > num2
num2 = num1
6) if num2>num3
num3=num2
7) if num3>num4
num4=num3
8) if num4>num5
num5=num4
9) counter is plus by 1

10) print num5, num4 ,num3, num2, num1

# data[].attributes.body
1. Initialize female counter as 0;
2. Ask the sex of one student.
3. If the sex is female, female counter +1. If not continue to do nothing.
4. after step three repeat step 1-3 for 100 times.
5.Print the number of the female counter.

import java.util.Random;
public class question10{
public static void main(String[] args){
int female = 0;
Scanner input = new Scanner(System.in);

for(int i=0 ; i<=9 ; i++){
System.out.println("enter sex");
sex = input.nextLine( );
if(sex.equals("female")||sex.equals("Female"){
female = female +1;
}
}
System.out.println("There are " + female + " females");
}

# data[].attributes.body
Should I use array in this question?
Answer : Yes

Can someone show example of this?

# data[].attributes.body
9.
1.initialize frequency=0
2.get a keyword from user("google")
3.read the webpage("google.com")

4.while page is not the end of the file
5.read one line from the page
6.for each word of the line
7.if the word is equal to the keyword
8.frequency=frequency+1

9.print the frequency of the keyword

# data[].attributes.body
9

# data[].attributes.body
Q8

1, Initialize string, char u, char e, u_counter, e_counter

2. Input sentence

3. Scan String

4. if (string.charAt(i) == e){

e_counter ++;}

5. if (string.charAt(i) == u){

u_counter ++;}

6. print e_counter & u_counter