Pada kesempatan kali ini kita akan mecoba membuat bentuk belah ketupat bintang menggunakan Netbeans dan dengan bahasa pemrograman Java.
Tampilannya seperti diatas.
Lansung saja ke tutorialnya :
- Buka Netbeans dan new project > Java > Next
- Beri nama projectnya.
- Ketikan Kodingnya.
- Jika berhasil maka tampilannya seperti berikut.
Berikut Coddingnya :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package belahketupat; | |
/** | |
* | |
* @author Aphriell_art | |
*/ | |
public class BelahKetupat { | |
/** | |
* @param args the command line arguments | |
*/ | |
public static void main(String[] args) { | |
// TODO code application logic here | |
String blog; | |
String NIM; | |
blog = "Esaprasetio.blogspot.com"; | |
System.out.println("Esa Prasetio Nugroho "+ blog); | |
System.out.println(""); | |
int l = 1; | |
int tingkat = 10; | |
int n = 12/2; | |
for(int i=1;i<=n;i++){ | |
for(int k=n;k>i;k--){ | |
System.out.print(" "); | |
} | |
for(int j=1;j<=l;j++){ | |
System.out.print("*"); | |
} | |
l+=2; | |
System.out.println(""); | |
} | |
l -= 4; | |
for(int i=(n-1);i>=1;i--){ | |
for(int k=i;k<=(n-1);k++){ | |
System.out.print(" "); | |
} | |
for(int j=l;j>=1;j--){ | |
System.out.print("*"); | |
} | |
l-=2; | |
System.out.println(""); | |
} | |
System.out.println("Esa Prasetio Nugroho "+ blog); | |
} | |
} |
Terimakasih
Semoga Bermanfaat.
Jangan Lupa Comment n follow this blog ya ...
Google + : https://plus.google.com/u/0/+esaprasetio
Twitter : http://twitter.com/aphriell_art
IG : @aphriel_art
Blog :
aprilartwork.blogspot.com for my artwork
aphriellart.blogspot.com for some tutorial
Email : aphriellart@gmail.com