Oleh: leonard260788 | Oktober 28, 2009

Web Programming Answers

Jawab  1

======

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<script language=”javascript”>

function program(){

var input = “”;
var total = 0;
var jumlah = 0;
var terendah = 0;
var tertinggi = 0;

do{

do{
input = prompt(“Masukkan\nangka 0-100 untuk input data\nKarakter atau String untuk selesai”, “”);
if(input == “”)alert(“Tidak ada data yang dimasukkan !”);

}while(input == “”);

if(isNaN(input)){
break;
}
if(jumlah == 0){
terendah = parseInt(input);
tertinggi = parseInt(input);
}

total += parseInt(input);
jumlah++;

if(parseInt(input) < terendah)terendah = parseInt(input);
if(parseInt(input) > tertinggi)tertinggi = parseInt(input);

}while(1);

alert(“Jumlah data yang diinput : ” + jumlah + “\nTotal : ” + total + “\nNilai terendah : ” + terendah + “\nNilai tertinggi : ” + tertinggi + “\nNilai rata – rata : ” + (total/jumlah));

}
</script>
</head>

<body onload=”program();”>
</body>
</html>

 

Jawab 2

======

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>::BIODATA::</title>
</head>
<script language=”javascript”>

function namaHari(nomor){

var hari = “”;
switch (nomor){
case 0 : hari=”Minggu”;break;
case 1 : hari=”Senin”;break;
case 2 : hari=”Selasa”;break;
case 3 : hari=”Rabu”;break;
case 4 : hari=”Kamis”;break;
case 5 : hari=”Jumat”;break;
case 6 : hari=”Sabtu”;break;
}
return hari;
}

function namaBulan(nomor){

var bulan = “” ;

switch (nomor){
case 0 : bulan=”Januari”;break;
case 1 : bulan=”Februari”;break;
case 2 : bulan=”Maret”;break;
case 3 : bulan=”April”;break;
case 4 : bulan=”Mei”;break;
case 5 : bulan=”Juni”;break;
case 6 : bulan=”Juli”;break;
case 7 : bulan=”Agustus”;break;
case 8 : bulan=”September”;break;
case 9 : bulan=”Oktober”;break;
case 10 : bulan = “November”;break;
case 11 : bulan = “Desember”;break;
}
return bulan;

}

function kataSapa(){

var date = new Date();
var sapa = “”;

if(date.getHours() < 12){
sapa = “Pagi”;
}
else if(date.getHours() < 15){
sapa = “Siang”;
}
else if(date.getHours() < 18){
sapa = “Sore”;
}
else sapa = “Malam”;

return sapa;
}

function enter(){

var nama = document.getElementById(“nama”).value;
var tgl = document.getElementById(“tgl”).value;
var komen = document.getElementById(“komen”).value;

var temp = tgl.split(“-”);
var dd = temp[0];
var mm = temp[1];
var yy = temp[2];

var hasil = “”;

hasil = “Hallo ” + nama + “, Selamat ” + kataSapa();

var date = new Date();
var tahun_sekarang = date.getYear();
var bulan_sekarang = date.getMonth() + 1;

if(bulan_sekarang < mm){
tahun_sekarang–;
bulan_sekarang+=12;
}

var tahun = tahun_sekarang – yy;
var bulan = bulan_sekarang – mm;

hasil += “\nUmur Anda : ” + tahun + ” tahun ” + bulan + ” bulan”;

var tglLahir = new Date(yy,mm-1,dd);

hariLahir = namaHari(tglLahir.getDay());

hasil += “\nAnda dilahirkan hari : ” + hariLahir;

hasil += “\n\n——————————————-”;

var arrKata = komen.split(” “);

hasil += “\nK-O-M-E-N-T-A-R Anda terdiri dari : ” + arrKata.length + ” kata”;

document.getElementById(“output”).value = hasil;
}
</script>

<body bgcolor=”#EEEEEE”>
<div style=”background-color:#F60;text-align:right;color:#FFF;font-weight:bold”>Hari ini :
<script language=”javascript”>
var date = new Date();

document.write(namaHari(date.getDay()) + “, ” + date.getDate() + ” ” + namaBulan(date.getMonth()) + ” ” + date.getYear());

</script>

</div>

<h1 style=”color:#F60″>INPUT DATA</h1>
<table width=”300″ border=”0″>
<tr>
<td>Nama :</td>
<td><input type=”text” name=”nama” id=”nama” /></td>
</tr>
<tr>
<td>Tanggal Lahir :</td>
<td><input type=”text” name=”tgl” id=”tgl” /></td>
</tr>
<tr>
<td>Komentar</td>
<td><textarea name=”komen” id=”komen” cols=”45″ rows=”5″></textarea></td>
</tr>
<tr>
<td><input type=”submit” name=”button” id=”button” value=”Enter”  onclick=”enter();”/></td>
<td>&nbsp;</td>
</tr>
</table>
<p style=”color:#F60″>&nbsp;</p>

<h1 style=”color:#F60″>OUTPUT</h1>
<p style=”color:#F60″>
<textarea name=”output” id=”output” cols=”45″ rows=”5″></textarea>
</p>
</body>
</html>

Jawab 3

=====

 

<html>

<head>

</head>

<body>

<div id=”kotak” style=”position:absolute;width:400px;height:300px;”>
<table bgcolor=”#EEEEEE”>
<tr>
<td colspan=”2″ bgcolor=”lightgreen”></td>
</tr>

<tr>
<td>No Data</td>
<td id=”no”></td>
</tr>

<tr>
<td>Warna</td>
<td id=”warna”></td>
</tr>

<tr>
<td>Kode RGB</td>
<td id=”kode”></td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td>
<input type=”button” value=”First” id=”first”

onclick=”move(0);”>
<input type=”button” value=”Prev” id=”prev”

onclick=”move(1);”>
<input type=”button” value=”Next” id=”next”

onclick=”move(2);”>
<input type=”button” value=”Last” id=”last”

onclick=”move(3);”>
</td>
</tr>
</table>
</div>

</body>

</html>

<object id=”data” classid=”CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83″>
<PARAM NAME = “DataURL” VALUE = “warna.txt”>
<PARAM NAME = “UseHeader” VALUE = “TRUE”>
<PARAM NAME = “TextQualifier” VALUE = “”>
<PARAM NAME = “FieldDelim” VALUE = “;”>
</object>
<script language=”javascript”>

var angel_jelek = data.recordset;

function move(i){
switch (i){
case 0 : angel_jelek.moveFirst();break;
case 1 :

angel_jelek.movePrevious();if(angel_jelek.BOF==true)angel_jelek.moveFirst();break;
case 2 :

angel_jelek.moveNext();if(angel_jelek.EOF==true)angel_jelek.moveLast();break;
case 3 : angel_jelek.moveLast();break;

}
document.getElementById(“no”).innerHTML = angel_jelek(0);
document.getElementById(“warna”).innerHTML = angel_jelek(1);
document.getElementById(“kode”).innerHTML = angel_jelek(2);
document.getElementById(“kotak”).style.backgroundColor = “” +

angel_jelek(2);

}

</script>

 

buat 1 file, kasih nama warna.txt letakkin satu folder sama jawab 3.

Isi file warna.txt :

nomor;warna;kode
1;fuchsia;#ff00ff
2;maroon;#800000
3;olive;#808000
4;purple;#800080
5;aliceblue;#f0f8ff
6;azure;#f0ffff
7;bisque;#ffe4c4
8;gold;#ffd700
9;indigo;#4b0082
10;lavender;#e6e6fa
11;crimson;#dc1436
12;honeydew;#f0fff0

Oleh: leonard260788 | Januari 16, 2009

Java Gaming

Exercise for gaming with Java. Hope this would help you.
http://www.kitaupload.com/download.php?file=279Hangoroo.rar

Oleh: leonard260788 | Januari 7, 2009

Sorting Java

class Sorting{
//buat sorting string , hafalin aja kayak gini
static public void bubbleSort(String array[]){
for(int i=0; i < array.length;i++){
for(int j=array.length-1;j > i;j–){
if(array[j].compareTo(array[j-1]) < 0 ){
//tukar
String temp = array[j];
array[j] = array[j-1];
array[j-1] = temp;
}
}

}
}

//buat sorting int, hafalin aja kayak gini
static public void bubbleSort(int array[]){
for(int i=0; i < array.length;i++){
for(int j=array.length-1;j > i;j–){
if(array[j] < array[j-1]){
//tukar
int temp = array[j];
array[j] = array[j-1];
array[j-1] = temp;
}
}

}
}

public static void main(String args[]){
String nama[] = {“Kerry”, “Angle”, “Fitri”, “Dimas”, “Robby”};
int angka[] = {5,65,45,4,53};

//cetak data awal
for(int i = 0; i < nama.length;i++){
System.out.print(nama[i] + ” “);
}
System.out.println(“”); // buat pindah baris

//ccetak data awal
for(int i = 0; i < angka.length;i++){
System.out.println(angka[i] + ” “);
}
System.out.println(“”); // buat pindah baris

bubbleSort(nama); // sort nama

bubbleSort(angka); // sort angka

System.out.println(“DATA SETELAH DISORTING”);
System.out.println(“======================”);

//cetak data setelah di sorting
for(int i = 0; i < nama.length;i++){
System.out.print(nama[i] + ” “);
}
System.out.println(“”); // buat pindah baris

//ccetak data setelah di sorting
for(int i = 0; i < angka.length;i++){
System.out.println(angka[i] + ” “);
}

}

}

Link untuk hapus  : http://www.kitaupload.com/download.php?file=451Sorting.java&del=384065&ignore=

Link untuk download :  http://www.kitaupload.com/download.php?file=451Sorting.java

Oleh: leonard260788 | Januari 5, 2009

ASP error , can’t insert or update table

May be this link would lead you to the solution , I had that problem and it had solved my problems.I can’t insert nor update the database.

Oleh: leonard260788 | November 20, 2008

Web programming

<html>
<head>
<title>No more one</title>
<script language=”javascript”>
function hitung(){

//alert(“denis leonard”);
var a = window.document.getElementsByName(“a”);
var op = window.document.getElementsByName(“op”);
var b = window.document.getElementsByName(“b”);

var x = parseInt(a[0].value);
var y = parseInt(b[0].value);

var hasil;

switch(op[0].value){
case “0″ : hasil = x + y;break;
case “1″ : hasil = x – y;break;
case “2″ : hasil = x * y;break;
case “3″ : hasil = x / y;break;

}

var z = window.document.getElementsByName(“hasil”);

z[0].value = hasil;

}
</script>

</head>
<body>
<input type = “text” name =”a”>
<select name = “op”>
<option value = “0″> + </option>
<option value = “1″> – </option>
<option value = “2″> * </option>
<option value = “3″> / </option>
</select>
<input type = “text” name = “b”>
<input type = “button” value=”=” name = “c” onClick=”hitung();”>
<input type = “text” name = “hasil”>
</body>

<!– dibuat oleh denis leonard–>

</html>

Download source code lengkap : http://www.kitaupload.com/download.php?file=863javascript.html

Oleh: leonard260788 | November 19, 2008

Kisi Kisi IMK

8 aturan emas
3 pilar perancangan interface
5 faktor manusia terukur
3 prinsip dalam merancang interface (kenali perbedaan user, menggunakan 8 aturan emas, mencegah kesalahan)
Untuk menguji hasil dari suatu rancangan dibutuhkan beberapa persyaratan dan pedoman. Sebutkan syarat dan pedoman dalam melkukan usability test dengan menggunakan lab!

Sebutkan dan jelaskan 3 pilar utama dalam perancangan user interface dan berikan contoh dari masing masing pilar!

Dalam merancang interface kita harus memikirkan 5 konsep manusia terukur. Sebutkan dan jelaskan!

Sebuah rumah sakit ingin membangun sistem informasi berbasis web . Anda sebagai desainer diminta untuk merancang konsep sistem tersebut!

Oleh: leonard260788 | Oktober 28, 2008

Object Oriented Programming

First of all, you must think about Object. People, car, pencil, etc are objects in the real world. We can carry these concept into Object Oriented Programming(OOP). Each object can have properties and methods. People have name and age properties for example. People can speak, eat, walk, kick, etc.

To make object in Object Oriented Programming, we must define class. Class is a blueprint of an object. In that class , we define the properties and the methods.
For example, I want to define People class. The People class will have name and age properties and also speak method. I will use C++ as the programming language. So, the declaration of the class will look like this :

class People{
char name[21];
int age;

speak();
}

Moreover, each class will have a method that will be executed, each time the object is made. This method is called constructor. The constructor must have the same name with the class name. We make People class , so the constructor name must be “People”. So, We add the constructor to the class.

class People{
char name[21];
int age;

People(); // constructor

speak();
}

Beside constructor, the class will also have destructor. Destructor must be named “~” + class name . So, the People destructor will look like this “~People”.
Both of constructor and destructor can not have return type.

class People{
char name[21];
int age;

People(); // constructor
~People(); // destructor

speak();
}

You have to keep the data private and the method public to make information hidding. The data can not be accesed outside the class. The data can only be accessed by the public method. Making setter and getter function is the way to do that. So , we add setter and getter method to People class.

class People{
private : // make the data private
char name[21];
int age;

public : // make the method public

People(); //constructor with no parameter
People(char[], int); //constructor with two parameters
~People(); //destructor
void setname(char[]); //setter function
void setage(int); //setter function
char* getname(); //getter function
int getage();  //getter function
void speak();  //member function
};

Now we make the methods definition and we write the main method to test the class.
Here is the full source code :

#include<constrea.h>
#include<string.h>

class People{
private :
char name[21];
int age;

public :
People(); //constructor with no parameter
People(char[], int); //constructor with two parameters
~People(); //destructor
void setname(char[]); //setter function
void setage(int); //setter function
char* getname(); //getter function
int getage();  //getter function
void speak();  //member function
};

//constructor with no parameter
People::People(){
setname(“noname”);
setage(0);
}

//constructor with two parameters
People::People(char name[], int age){
setname(name);
setage(age);
}

People::~People(){
cout << “destructor” << endl;
}

void People::setname(char name[]){
strcpy(this->name, name);
}

void People::setage(int age){
this->age = age;
}

char* People::getname(){
return name;
}

int People::getage(){
return age;
}

void People::speak(){
cout << “My name is ” << name << endl;
cout << “I’am ” << age << ” years old” << endl;
}

void main(){

People john; // calling constructor with no paramater
/*
make an object of People class
the object name is john
*/
john.speak(); //calling speak method

People susi(“susi”, 20); // calling constructor with two parameters

susi.speak();

/*
setting name = john and age = 30 to john
*/
john.setname(“john”);
john.setage(30);
john.speak(); // john speak “My name john I’m 30 years old”

getch();

}

The pattern of calling the method is ObjectName.MethodName(Parameter);. But ,if you want to call the method of the class, you must first making an object of that class. Simply by writing People john; You have already made an object. The name of the object is john and john is an object of People class. Now, you can use the method of People class.

In the source, you will see that the constructor is overloaded. Yes, we can overload the constructor. In this example, I make two constructors. The first constructor have no parameter and the second one have two parameters. So , if you want to call the first constructor, you can write People john; . This will execute constructor with no parameter.
If you want to call the second constructor, you can write People susi(“susi”, 20); . It will call constructor which has two parameters. But how can I call the destructor? Good question. The destructor will be executed automatically when the object is dead.

Oleh: leonard260788 | September 22, 2008

web programming javascript

Langsung kita mulai saja petualangan kita di javascript. Ha5. Script javascript dapat Anda buat dan ditaruh di html. Script tersebut akan dijalankan pada browser Anda, maka pastikan terlebih dahulu settingan di browser Anda, agar javascript diaktifkan. Script javascript bisa ditaruh seperti berikut ini :

<html>

<head>

<script languange=”javascript”>
taruh script Anda di sini
</script>

</head>

<html>

Kita dapat membuat suatu fungsi di dalam tag script tersebut.  Contohnya :

<script languange=”javascript”>

function tes(){

prompt(“Masukkan angka?”, “”);

}
</script>

Untuk menjalankan fungsi tersebut , perlu ada pemicunya. Contoh bila kita ingin menjalankan fungsi tersebut sewaktu <body> di load , maka kita dapat memanggilnya seperti berikut :

<html>

<head>

<script>

function tes(){

prompt(“Masukkan angka?”, “”);

}

</script>

</head>

<body onLoad=”tes();”>

Di sini body HTML

</body>

</html>

Kita menambahkan sesuatu pada body , yaitu onLoad=”tes();”. Artinya sewaktu <body> diLoad, maka fungsi tes(); alan dijalankan. Fungsi tes akan menampilkan prompt ke layar , meminta inputan dari user. Parameter pertama merupakan pesan yang ingin disampaikan dan parameter kedua adalah default valuenya. Prompt akan mengembalikan apa yang diinput user. Jadi kita dapat mengambil data yang diinput user seperti berikut : var inputan_user = prompt(“Masukkan Angka?”, “”); . Dengan begini , kita mempunyai suatu varibael bernama inputan_user yang akan menampung hasil dari prompt. Kita bisa juga menggunakan fungsi isNaN(inputan_user) , fungsi tersebut akan mengecek apakah variabel inputan_user bukan suatu number. Jika variabel tersebut bukan suatu number, maka akan dikembalikan nilai true, sebaliknya akan dikembalikan false. Dari fungsi tersebut kita dapat tau apakah yang dimasukkan oleh user adalah number atau bukan dengan memakai fungsi isNaN(inputan_user).

Untuk membuat variabel bisa dengan cara seperti berikut:
var angka = 100;
Tipe data di javascript adalah varian sehingga kita tidak perlu mendefinisikan tipe datanya.

Sekarang kita akan membuat suatu javascript yang akan mengubah isi table yang masih kosong dengan isian dari hasil inputan user.

<html>
<head>
<script>
function tes(){
var inputan_user = prompt(“Masukkan angka?”, “”);
if(isNaN(inputan_user) == false){
document.getElementById(“isi”).innerHTML = inputan_user;
}
else{
alert(“Yang Anda input bukan number”);
}
}
</script>
</head>
<body onLoad=”tes();”>
<table border=”1″>
<tr>
<td id=”isi”></td>
<tr>
</table>
</body>
</html>

Kita juga perlu memperhatikan penggunaan huruf besar dan huruf kecil karena javascript merupakan bahasa yang case-sensitif yang membedakan uruf besar dan huruf kecil.

Pada contoh diatas kita meminta user menginput data. Yang apabila data tersebut adalah suatu number , maka akan ditampilkan di table , sedangkan apabila user menginput sesuatu yang bukan merupakan number maka akan dimunculkan suatu kotak dialog yang bertuliskan pesan “Yang Anda input bukan number”.

Jika ingin mencoba codingnya , ganti dulu tanda petik dua -> “, kalo gak diganti bakal error.

Sekian tutorial dari saya, semoga bermanfaat untuk kita semua. Terima kasih atas kunjungannya. ^-^

Oleh: leonard260788 | April 27, 2008

I will

I will Survive..Yeah..Yeah

Oleh: leonard260788 | Februari 27, 2008

Tujuan Hidup u?!?Apa yah..

TUJUAN HIDUP
Pernah gak kepikir tentang arti dan tujuan hidup u???
gw bilang, gak semua orang mikirin itu,hehehe.
menurut gw aja lho..Hari ini , gw coba merenung, lalu kepikiran kalo di setiap kegiatan yang kita kerjakan seharusnya ada suatu tujuan di dalamnya.Sebagai contohnya dalam hal yang paling sederhana saja, tujuan kita makan -> untuk mengisi perut supaya gak laper, tujuan kita tidur -> untuk beristirahat, tujuan kita ke kampus -> untuk belajar dan menambah ilmu (ini kalo gw sih , kalo yang lain gak tau juga deh)hehee..Terus contoh yang lainnya , tujuan kita belajar -> supaya kita bisa pinter(gak mungkin kan tujuan belajar supaya tambah bodoh)..Nah ,dari sekian banyak contoh yang kita bisa peroleh, harusnya kita sadar bahwa yang kita lakukan itu harusnya memiliki suatu tujuan(yang harus kita capai), contohnya , gak ada kan orang yang makan tapi maunya masih laper, orang yang mau tidur supaya masih cape , orang belajar supaya tambah gak bisa????..Nah, itu berarti kita harus menetapkan tujuan dibalik suatu aksi yang kita lakukan, supaya aksi itu pun bermakna baik bagi kita maupun bagi orang lain. Lalu apa hubungannya sama tujuan hidup?Ok we will go on, coba kita telusuri lebih dalam lagi, kalo setiap tindakan yang kecil pun memiliki tujuannya, coba kita melihat ke arah yang lebih besar lagi, yang lebih panjang, yang lebih konseptual lagi.Tujuan kita kuliah? Nah , udah mulai susah nih ngejawabnya..hehehe….Pasti banyak deh jawabannya , ada yang cari ilmu dan pengetahuan , cari gelar, cari pacar, cari duit(upsss bukan, ini setelahnya), dll.Pasti bingung kan?Tujuan kita kuliah apa?..Well, itu baru masuk ke lingkup yang lebih besar lagi, Pernah berpikir gak?Kok cepet banget sich waktu berlalu?Pernah takut gak, kalo jam ini terus bergerak maju(u gak bisa berhentiin waktu) , dan umur kita pun semakin tua?.Kita ini gak selamanya hidup di dunia ini, so apa gak ada penyesalan nantinya gitu??.Gw pernah denger lagu “Tomorrow never comes until its to late” , ada benernya juga, kita selalu melakukan penyesalan di kemudian hari.Besok selalu terlambat, kalo kita gak nyesel, hari esok gak dateng dateng juga , kira – kira seperti itulah.
Oke, kita ke inti masalahnya sekarang,yaitu tujuan hidup.Gw kasih analoginya, agak lucu sih(in baru kepikiran setelah gw digigit nyamuk).hahahaha.
Ini cerita tentang nyamuk , yang hidupnya untuk menghisap darah kita aja, terus ita tepuk dia mati, .Malahan walaupun kita sudah bawa raket nyamuk, tapi dia masih aja bandel, masih mau hisap darah kita.Disundut, langsung gosong…hahaaha..
coba u pikir deh begitu berharganya hidup kita ini dibanding seekor nyamuk yang tujuannya cuma menghisap darah aja , disetrum udah mati,hahahaha…Lalu , kita apa kita mau kalah ama nyamuk??????Gak kan????so, what is the plan for your life????U must design it, you are the designer of your life.Jangan kalah ama nyamuk, nyamuk aja punya tujuan hidup.hehee…Berjuang tuh nyamuk, buat dapetin darah u, ampe rela disundut pake raket listrik yang penting tujuan dia harus tercapai..hehehe..Kira – kira udah dapet blom tujuan hidup ????Itu adalah suatu pertanyaaan besar dan paling susah dijawab secara jujur dan bijaksana(kalo mau bohong sih gampang aja jawabnya)hehe.Sekian

Tulisan Sebelumnya »

Kategori