package teuku.neo.quinn.
main;
public class TestFive {
public static void main(String[]args){
int nrOfStudents = 20;
int[] hight = new int [nrOfStudents];
int index = 0;
int theHighest = 0;
//Loop menghitung jumlah tinggi murid
for (int i = 0; i < nrOfStudents; i++ )
hight[i] = 150 + (int) (Math.random() * 60);
for (int i = 0; i < nrOfStudents; i++ )
System.out.println("The height of student = " + (i + i) + " : " + hight[i]);
//Loop menghitung jumlah murid yang ikut porseni
System.out.println("\n");
System.out.println("These students are selected for porseni : ");
for (int i = 0; i < nrOfStudents; i++){
if(hight[i] >= 170){
System.out.println("Student = " + (i + 1) + " : " + hight[i]);
//Loop menghitung jumlah murid tertinggi
System.out.println("\n");
theHighest = hight[0];
for (int i = 0; i < nrOfStudents; i++ ){
if (hight[i] > theHighest){
theHighest = hight[i];
index = i;
System.out.println("The highest students = " + (index + 1) + " : " + theHighest);
//Menghitung jumlah kata
String name="Teuku Neo Quinn";
char[] nameChars;
int nrOfWords=0;
nameChars=name.toCharArray();
for (int i =0; i<name.length(); i++)
if (nameChars[i]==' ')
nrOfWords=nrOfWords+1;
System.out.println("The Number of Words :" + (nrOfWords+1));
int nrOfCapitals=0;
for (int i =0; i<name.length(); i++)
if((nameChars[i]>=65)&&(nameChars[i]<=90))
nrOfCapitals=nrOfCapitals+1;
System.out.println("The number of Capital :" + nrOfCapitals);
int nrOfVocal=0;
for (int i =0; i<name.length(); i++)
if(nameChars[i]=='a'|nameChars[i]=='i'|nameChars[i]=='u'|nameChars[i]=='e'|nameChars[i]=='o')
{
nrOfVocal=nrOfVocal+1;
System.out.println("The number of Vocal :" + nrOfVocal);