Flowchart :
Flowchart Aplikasi
Disini saya menggunakan 1 class yaitu class barang dimana di class tersebut terdapat beberapa variabel dengan menggunakan tipe data String dan Integer.
Script Aplikasi
Script Aplikasi
Script Aplikasi
Source Code :
/** 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 barang;
import java.util.Scanner;
/**
*
* @author Syukron U'Baidillah
* NIM : 19201069/P
*/
public class Barang {
private Integer id;
private String nama;
private Integer harga;
private Integer stok;
public void setId(Integer P_id){
this.id = P_id;
}
public Integer getId(){
return this.id;
}
public void setNama(String P_nama){
this.nama = P_nama;
}
public String getNama(){
return this.nama;
}
public void setHarga(Integer P_harga){
this.harga = P_harga;
}
public Integer getHarga(){
return this.harga;
}
public void setStok(Integer P_stok){
this.stok = P_stok;
}
public Integer getStok(){
return this.stok;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
Barang[] databarang = new Barang[3];
System.out.println("Aplikasi stok Barang");
System.out.println("====================");
for(int a=0; a<databarang.length; a++){
databarang[a] = new Barang();
/**
* Inputan ke array
*/
System.out.print("Id Barang : ");
databarang[a].setId(input.nextInt());
System.out.print("Nama Barang : ");
databarang[a].setNama(input.next());
System.out.print("Harga Barang : ");
databarang[a].setHarga(input.nextInt());
System.out.print("Stok Barang : ");
databarang[a].setStok(input.nextInt());
System.out.println("====================");
}
System.out.println("\n\nNama : Syukron U'baidillah \nNim : 19201069/P \nTahun Release : 2019");
System.out.println("\n\nId Barang \tNama Barang \tHarga Barang \tStok Barang");
for (int b=0; b<databarang.length; b++){
String tampil = String.format("%s\t\t%s\t\t%s\t\t%s",
databarang[b].getId(), databarang[b].getNama(),
databarang[b].getHarga(), databarang[b].getStok());
System.out.println(tampil);
}
}
}
/**
* Copyright Syukron@2019
*/
Lebih Lengkapnya bisa download link dibawah ini :
PDF : Klik disini
PPT : Klik disini