Latihan Class Data Mahasiswa

Class Mahasiswa

public class Mahasiswa{
	private String nim;
	private String nama;
	private String prodi;

	public Mahasiswa(String nim, String nama, String prodi){
		this.nim=nim;
		this.nama=nama;
		this.prodi=prodi;
	}
	public Mahasiswa(String nim, String nama){
		this.nim=nim;
		this.nama=nama;
		this.prodi="S-1 SI";
	}
	public String getNama(){
		return nama;
	}
	public void setNama(String nama){
		this.nama=nama;
	}
	public String getNim(){
		return nim;
	}
	public String toString(){
		return nim + "\t" + nama + "\t" + prodi;
	}
	public static void main(String []argv){
		Mahasiswa m=new Mahasiswa("09410410001","Joss","S1-SI");
		System.out.println(m);
	}
}

Class DataMhs

import java.util.*;

public class DataMhs{
	private Vector dbMhs=new Vector();
	private void initDb(){
		dbMhs.add(new Mahasiswa("07410100151","Erza Pradipta Madana"));
		dbMhs.add(new Mahasiswa("08410100282","Qudsi Ashara Pradyan"));
		dbMhs.add(new Mahasiswa("08410100390","Falis Rohman"));
		dbMhs.add(new Mahasiswa("08410100404","Anugerah Syaifullah Prakosa"));
		dbMhs.add(new Mahasiswa("09410100092","Yusron Alifi"));
		dbMhs.add(new Mahasiswa("09410100161","Yosarda Argadita Pahlawi"));
		dbMhs.add(new Mahasiswa("10410100147","Ayu Puji Hastutik Wahono"));
		dbMhs.add(new Mahasiswa("10410100156","Metta Ameilia Damayanti"));
		dbMhs.add(new Mahasiswa("10410100182","Alfian Eka Primadani"));
		dbMhs.add(new Mahasiswa("10410100188","Feriyan"));
		dbMhs.add(new Mahasiswa("10410100215","Trio Agustino"));
		dbMhs.add(new Mahasiswa("10410100217","Bangkit Indra Lesmana"));
		dbMhs.add(new Mahasiswa("10410100227","Habibie Rezha Aditya"));
		dbMhs.add(new Mahasiswa("10410100246","Muhammad Arijuddin"));
		dbMhs.add(new Mahasiswa("10410100269","Rizal Khoiru Rokhim"));
		dbMhs.add(new Mahasiswa("10410100275","Yanu Kerta Wijaya"));
		dbMhs.add(new Mahasiswa("10410100281","Rizki Anggriawan Pratama"));
		dbMhs.add(new Mahasiswa("11410100003","Gregorius Andri Putra Purnomo"));
		dbMhs.add(new Mahasiswa("11410100009","Bagus Eka Pratama Putra"));
		dbMhs.add(new Mahasiswa("11410100015","Andrean Firza Adinugraha"));
		dbMhs.add(new Mahasiswa("11410100016","I Putu Aria Widi Kurniawan"));
		dbMhs.add(new Mahasiswa("11410100020","I Putu Narario Sastra"));
		dbMhs.add(new Mahasiswa("11410100032","Dion Audia Manurung"));
		dbMhs.add(new Mahasiswa("11410100038","Sulistyo Wasono"));
		dbMhs.add(new Mahasiswa("11410100045","Ryan Alfian Widyantoro"));
		dbMhs.add(new Mahasiswa("11410100046","Abdullah Addaba"));
		dbMhs.add(new Mahasiswa("11410100051","Wahyu Agus Permana"));
		dbMhs.add(new Mahasiswa("11410100056","Dachna Mickha El Rachim"));
		dbMhs.add(new Mahasiswa("11410100114","Anto Boga"));
		dbMhs.add(new Mahasiswa("11410100119","Indra Nugraha"));
		dbMhs.add(new Mahasiswa("11410100122","Yonatan Eric Mulyono"));
		dbMhs.add(new Mahasiswa("11410100142","Himawan Pradipta Utama"));
		dbMhs.add(new Mahasiswa("11410100144","Dewangga Putra Kartika Prasetyo"));
		dbMhs.add(new Mahasiswa("11410100172","Ramadhan Lutfi Arfandiansya"));
		dbMhs.add(new Mahasiswa("11410100175","Tagor Purba"));
		dbMhs.add(new Mahasiswa("11410100206","Muhammad Fuad"));
	}
	public DataMhs(){
		initDb();
	}
	public void viewAll(){
		System.out.println("Data Mahasiswa PBO");
		for(Mahasiswa mhs:dbMhs)
			System.out.println(mhs);
	}
	public void cari(String nama){

	}
	public static void main(String []argv){
		DataMhs dmhs=new DataMhs();
		dmhs.viewAll();
	}
}
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Latihan Class Data Mahasiswa

  1. Perut Buncit says:

    hanya bisa membaca dengan seksama. blum mampu memberikan komentar apalagi memberikan masukan yang membangun.

Leave a Reply

Your email address will not be published. Required fields are marked *