Program Java menghitung Luas segitiga:
package myprojects.kelas;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
class segitiga
{
Scanner reinert=new Scanner(System.in);
float a,t;
float L;
void input()
{
System.out.print("luas segitiga");System.out.println();
System.out.print("masukkan a= "); a=reinert.nextFloat();
System.out.print("masukkan t= "); t=reinert.nextFloat();
};
void output()
{
System.out.print("luas= "+(a*t/2));
};
}
Program Java menghitung Luas Bujur Sangkar:
package myprojects.kelas;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
class bujur_sangkar
{
Scanner reinert=new Scanner(System.in);
float s;
float L;
void input()
{
System.out.print("luas bujur sangkar");System.out.println();
System.out.print("masukkan s= "); s=reinert.nextFloat();
};
void output()
{
System.out.print("luas= "+(s*s));
};
}
Program Java menghitung Luas Lingkaran:
package myprojects.kelas;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
class lingkaran
{
Scanner reinert=new Scanner(System.in);
float jari_jari;
float L;
void input()
{
System.out.print("luas lingkaran");System.out.println();
System.out.print("masukan jari-jari= ");jari_jari=reinert.nextFloat();
};
void output()
{
System.out.print("Luas= "+(3.14*jari_jari*jari_jari));
};
}
Program Java menghitung Luas Layang-layang:
package myprojects.kelas;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
class layang_layang
{
Scanner reinert=new Scanner(System.in);
float diagonal_1;
float diagonal_2;
float L;
void input()
{
System.out.print("luas layang-layang");System.out.println();
System.out.print("masukan diagonal 1= ");diagonal_1=reinert.nextFloat();
System.out.print("masukan diagonal 2= ");diagonal_2=reinert.nextFloat();
};
void output()
{
System.out.print("Luas= "+(0.5*diagonal_1*diagonal_2));
};
}
Program Java menghitung Luas jajar Genjang:
package myprojects.kelas;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
class jajar_genjang
{
Scanner reinert=new Scanner(System.in);
float alas;
float tinggi;
float L;
void input()
{
System.out.print("luas jajar genjang");System.out.println();
System.out.print("masukan alas= ");alas=reinert.nextFloat();
System.out.print("masukan tinggi= ");tinggi=reinert.nextFloat();
};
void output()
{
System.out.print("Luas= "+(alas*tinggi));
};
}
Script PHP membuat kalender:
//This gets today's date
$date =time () ;
//This puts the day, month, and year in seperate variables
$day = date('d', $date) ;
$month = date('m', $date) ;
$year = date('Y', $date) ;
//Here we generate the first day of the month
$first_day = mktime(0,0,0,$month, 1, $year) ;
//This gets us the month name
$title = date('F', $first_day) ;
$day_of_week = date('D', $first_day) ;
switch($day_of_week){
case "Sun": $blank = 0; break;
case "Mon": $blank = 1; break;
case "Tue": $blank = 2; break;
case "Wed": $blank = 3; break;
case "Thu": $blank = 4; break;
case "Fri": $blank = 5; break;
case "Sat": $blank = 6; break;
}
$days_in_month = cal_days_in_month(0, $month, $year) ;
echo "
";
echo " $title $year |
";
echo "M | S | S | width=15>R | K | J | S |
";
$day_count = 1;
echo "";
while ( $blank > 0 )
{
echo " | ";
$blank = $blank-1;
$day_count++;
}
$day_num = 1;
while ( $day_num <= $days_in_month )
{
echo " $day_num | ";
$day_num++;
$day_count++;
if ($day_count > 7)
{
echo "
";
$day_count = 1;
}
}
while ( $day_count >1 && $day_count <=7 )
{
echo " | ";
$day_count++;
}
echo "
";
?>