This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Senin, 28 November 2011

Pewarnaan Karakter pada JSP

Pewarnaan Tiap Karakter dalam Satu Kalimat dengan JSP

Algoritma :
  1. Inputkan teks kalimat
  2. tentukan banyaknya huruf dalam kalimat tersebut
  3. dengan menggunakan perulangan for dan seleksi if-else cek tiap huruf. Apabila ada spasi, maka cetak spasi (" ")
  4. bila tidak cetak huruf sesuai dengan urutan warna (merah, kuning, hijau, biru, dan ungu)
  5. Ulangi program hingga karakter pada kalimat berakhir

file color.jsp


Input Kalimat :





<%
String kal = request.getParameter("kalimat");
String btnSubmit = request.getParameter("btn");

if(btnSubmit == null){
return;
}

int x = 1;
out.print("Hasil Pewarnaan = ");
for(int i=0; i
String a = kal.substring(i,i+1);
if(a.equals (" ")== true){
out.println(" ");
}
else{
if(x == 6){
x = 1;
}
if(x%5==0){
out.print(""+a+"");
}
else if(x%4==0){
out.print(""+a+"");
}
else if(x%3==0){
out.print(""+a+"");
}
else if(x%2==0){
out.print(""+a+"");
}
else{
out.print(""+a+"");
}
x++;
}
}
%>


ScreenShot hasil :