Beruflich Dokumente
Kultur Dokumente
FUNGSI 3 METHOD
/*
*/
package fungsi3a;
/**
*/
package fungsi3;
* @author LAB1AMIKOM
/**
*/
* @author LAB1AMIKOM
*/
public static int jumlah(){
int a= 7, b= 15;
return (a +b);
int a= 7, b= 15;
/**
return (a +b);
*/
/**
*/
System.out.println(obyek.jumlah());
System.out.println(jumlah());
}
}
FUNGSI PARAMETER
/*
*/
package kuis;
*/
/**
package fungsiparameter;
/**
* @author LAB1AMIKOM
*/
* @author LAB1AMIKOM
*/
return (a +b);
return a;
}
}
/**
return (a -b);
*/
int a= 7, b= 15;
return (a*b);
}
}
FUNGSI 1 methode
/**
/*
*/
*/
package fungsi1;
/**
* @author LAB1AMIKOM
data_lulus[0][0] = 110;
*/
data_lulus[0][1] = 125;
data_lulus[0][2] = 135;
data_lulus[1][0] = 56;
System .out.println("==========================");
data_lulus[1][1] = 75;
data_lulus[1][2] = 85;
/**
System.out.print("Jurusan(0=TI, I=SI)=");
jurusan = input.nextInt();
*/
if ((jurusan ==0)||(jurusan==1))
System.out.print("Tahun(2006-2008): ");
garis();
tahun=input.nextInt();
tahun-=2006;
garis();
if((tahun>=0)&&(tahun<=2))
{
Data Lulusan
System.out.println("jumlah lulusan="
/*
+data_lulus[jurusan][tahun]);
*/
package larik8;
import java.util.Scanner;
/**
*
* @author Ozi
*/
public class Larik8 {
}
}
LARIK 3
* To change this template, choose Tools | Templates
rata =total/5;
*/
System.out.println("Rata-rata = "+rata);
}
package larik3;
import java.util.Scanner;
* @author LAB1AMIKOM
*/
*/
package latihan.pkg3;
import java.util.Scanner;
/**
/**
* @author LAB1AMIKOM
*/
*/
/**
*/
int bilangan;
bilangan = masuk.nextInt();
nilai[i][j] = masuk.nextInt();
if (bilangan % 2 ==0){
System.out.println("Bilangan Genap");
}else {
System.out.println("Data niali yang dimasukan");
System.out.println("Bilangan Ganjil");
{ System.out.println(nilai [i][j]);
}
}
total = 0;
for (int i = 0; i < 5 ; i++)
for (int j = 0; j < 2; j++)
LUAS LINGKARAN
Scanner input = new Scanner(System.in);
int r, Luas;
System.out.print("masukkan jari-jari:");
r = input.nextInt();
}
}
Luas = (22*r*r)/7;
PENJUMLAHAN
System.out.println("Luas Lingkaran adalah: "+Luas);
package prj3;
import java.util.Scanner;
LUAS SEGETIGA
/**
* @author LAB1AMIKOM
System.out.print("alas : ");
*/
a = masuk.nextInt();
System.out.print("tinggi : ");
/**
t = masuk.nextInt();
Luas = (a * t) /2;
*/
public static void main(String[] args) {
PENJUMLAHAN
b=masuk.nextInt();
System.out.print("Bilangan 1 : ");
c=a+b;
A = masuk.nextInt();
System.out.println("Hasil penjumlahan="+c);
System.out.print("Bilangan 2 : ");
B = masuk.nextInt();
jumlah = A + B;
kurang = A - B;
kali = A * B;
bagi = A / B;
ARRAY 1-100
/*
/**
*/
*/
package arraysample;
/**
int array[];
* @author LAB1AMIKOM
*/
array[0] = 5;
array[1] = 8;
/**
array[2] = 20;
array[3] = 9;
*/
array[5] = 10;
System.out.println("array["+i+"]="+array[i]);
}
for(int i=0;i<100;i++)
{
}
}
ages[i]=i+1;
System.out.print(ages[i]+" ");
ARRAY
package array;
}
}
public static void main(String[] args) {
ARRAY
int array[];
/*
array[0] = 5;
array[1] = 8;
array[2] = 20;
for(int i=0; i<5; i++)
{
* @author LAB1AMIKOM
*/
System.out.println("array["+i+"]="+array[i]);
}
Nim[i] = in.next();
System.out.print("\tNama : ");
ARRAY SAMPLE
Nama[i] = in.next();
package arraysample;
System.out.print("\tAlamat : ");
Alamat[i] = in.next();
System.out.print("\tKota : ");
Kota[i] = in.next();
System.out.print("\tTelepon : ");
Telp[i] = in.next();
System.out.print(ages[i]);
Jns_k[i] = in.next();
}
Tinggi[i] = in.nextInt();
ARRAY
System.out.println();
package javaapplication13;
}
System.out.println("Laporan:");
import java.util.Scanner;
+ "\t" + Tinggi[i]);
System.out.println("Data Mahasiswa");
System.out.println("Masukkan Jumlah Data: ");
data = in.nextInt();
}
}
BUFFERED RAIDER
BUFFERED RAIDER
package praktikum1;
import java.io.BufferedReader;
import javax.swing.JOptionPane;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.io.EOFException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.IOException;
//scanner
System.out.println("carikode.com \n");
//Buffered Reader
try {
nama = input.readLine();
String sn = "";
}
catch(IOException e){
try {
System.out.println("ERROR");
sn = dataIn.readLine();
}
}
catch(IOException e) {
System.out.println("Error!");
try{
//JOptionPane
alamat = input.readLine();
String tn = JOptionPane.showInputDialog("Third
Number : ");
int n1 = Integer.parseInt(fn);
int n2 = Integer.parseInt(sn);
catch(IOException e){
int n3 = Integer.parseInt(tn);
System.out.println("ERROR");
"JAWABAN", JOptionPane.PLAIN_MESSAGE);
}
}
BUFFERED RAIDER
System.out.print("Alamat: ");
/*import java.io.* ;
try {
alamat = input.readLine();
*/
catch(IOException e){
System.out.println("ERROR");
package bufferedreader.hendrapradiptiya.pkg15.pkg12.pkg0064;
import java.io.*;
/**
* @author Hendra
try {
TTL = input.readLine();
*/
public class BufferedreaderHendrapradiptiya15120064 {
}
catch(IOException e){
System.out.println("ERROR");
/**
* @param args the command line arguments
*/
try {
jeniskelamin = input.readLine();
}
catch(IOException e){
System.out.println("ERROR");
}
String hobi=" " ;
System.out.print("Hobi : ");
try {
catch(IOException e){
System.out.println("ERROR");
}
hobi = input.readLine();
}
catch(IOException e){
System.out.println("ERROR");
}
String notelepon=" " ;
System.out.print("Telepon: ");
try {
catch(IOException e){
System.out.println("ERROR");
}
notelepon = input.readLine();
}
catch(IOException e){
System.out.println("ERROR");
String temp;
try {
tinggibadan = input.readLine();
}
catch(IOException e){
System.out.println("ERROR");
System.out.println("Nama: ");
nama[i] = dtmasuk.readLine();
BUFFERED RAIDER
nama[j + 1] = nama[j];
nama[j] = temp;
/*
}
*/
package prjutamaurutkata;
}
import java.io.BufferedReader;
}
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
masuk.TambahData();
* @author Aspire
masuk.TampilUrutData();
*/
}
* @author LAB1AMIKOM
DO WHILE
*/
TAMPIL ANGKA 3 6 9 12 15
package prjlatihan11;
public class Prjlatihan11 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int bil = 0;
do{
System.out.println(bil+"");
do{
bil= bil+3;
}while(bil<=15);
bil++;
}while(bil<5);
}
}
}
DO WHILE
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package prjlatihan11;
/**
*