Contoh Jawaban UTS PBO

Berikut ini adalah salah satu  contoh jawaban UTS PBO.

Contoh Keluaran Program

Class Diagram Survey GSM

Class KartuSeluler

 public class KartuSeluler {
	private String namaKartu;
	private int jPria;
	private int jWanita;

	public KartuSeluler(String namaKartu, int jPria, int jWanita) {
		this.namaKartu = namaKartu;
		this.jPria = jPria;
		this.jWanita = jWanita;
	}
	public KartuSeluler(String nama) {
		this.namaKartu=nama;
	}
	/**
	 * @return the namaKartu
	 */
	public String getNamaKartu() {
		return namaKartu;
	}
	/**
	 * @param namaKartu the namaKartu to set
	 */
	public void setNamaKartu(String namaKartu) {
		this.namaKartu = namaKartu;
	}
	/**
	 * @return the jPria
	 */
	public int getjPria() {
		return jPria;
	}
	/**
	 * @param jPria the jPria to set
	 */
	public void setjPria(int jPria) {
		this.jPria = jPria;
	}
	/**
	 * @return the jWanita
	 */
	public int getjWanita() {
		return jWanita;
	}
	/**
	 * @param jWanita the jWanita to set
	 */
	public void setjWanita(int jWanita) {
		this.jWanita = jWanita;
	}
	public String toString(){
		return namaKartu+"\tP:"+jPria + "\tW:"+jWanita;
	}
}

Class Provider

import java.util.*;

public class Provider {
	private Vector daftarKartu=new Vector();
	private String namaProvider;
	public Provider(String nama) {
		this.namaProvider = nama;
	}
	public int hitungPenggunaPria(){
		int total=0;
		for(KartuSeluler kartu:daftarKartu)
			total +=kartu.getjPria();
		return total;
	}
	public int hitungPenggunaWanita(){
		int total=0;
		for(KartuSeluler kartu:daftarKartu)
			total +=kartu.getjWanita();
		return total;
	}
	public void addKartu(KartuSeluler kartu){
		daftarKartu.add(kartu);
	}
	public String getNamaProvider(){
		return namaProvider;
	}
}

Class SurveyGSM

public class SurveyGSM {
	private KartuSeluler []daftarKartu={
			new KartuSeluler("Mentari"),
			new KartuSeluler("Matrix"),
			new KartuSeluler("IM3"),
			new KartuSeluler("Simpati"),
			new KartuSeluler("Halo"),
			new KartuSeluler("AS"),
			new KartuSeluler("XL"),
			new KartuSeluler("3")
	};
	private Provider daftarProvider[]={
			new Provider("Indosat"),
			new Provider("Telkomsell"),
			new Provider("XL"),
			new Provider("3")
	};

	public void initDataRandom(){
		int jPria=0;
		int jWanita=0;
		for(KartuSeluler kartu:daftarKartu){
			jPria=(int)(Math.random()*100);
			jWanita=(int)(Math.random()*100);
			kartu.setjPria(jPria);
			kartu.setjWanita(jWanita);
		}
		daftarProvider[0].addKartu(daftarKartu[0]);
		daftarProvider[0].addKartu(daftarKartu[1]);
		daftarProvider[0].addKartu(daftarKartu[2]);
		daftarProvider[1].addKartu(daftarKartu[3]);
		daftarProvider[1].addKartu(daftarKartu[4]);
		daftarProvider[1].addKartu(daftarKartu[5]);
		daftarProvider[2].addKartu(daftarKartu[6]);
		daftarProvider[3].addKartu(daftarKartu[7]);
	}
	public void cetakPenggunaKartu(){
		for(KartuSeluler kartu:daftarKartu)
			System.out.println(kartu);
	}

	public static void main(String arg[]){
		SurveyGSM survey=new SurveyGSM();
		survey.initDataRandom();
		survey.cetakPenggunaKartu();
		System.out.println("Jumlah Responden Pria\t:" + survey.hitungJmlPria());
		System.out.println("Jumlah Responden Wanita\t:" + survey.hitungJmlWanita());
		System.out.println("Kartu Seluler Paling diminati Pria\t:" + survey.cariKartuFavPria().getNamaKartu());
		System.out.println("Kartu Seluler Paling diminati Wanita\t:" + survey.cariKartuFavWanita().getNamaKartu());
		System.out.println("Provider Paling diminati Pria\t:" + survey.cariProvFavPria().getNamaProvider());
		System.out.println("Provider Paling diminati Wanita\t:" + survey.cariProvFavWanita().getNamaProvider());

	}
	public int hitungJmlPria(){
		int total=0;
		for(KartuSeluler k:daftarKartu)
			total +=k.getjPria();
		return total;
	}
	public int hitungJmlWanita(){
		int total=0;
		for(KartuSeluler k:daftarKartu)
			total +=k.getjWanita();
		return total;
	}
	public KartuSeluler cariKartuFavPria(){
		KartuSeluler k=daftarKartu[0];
		for(KartuSeluler k0:daftarKartu)
			if(k.getjPria()<k0.getjPria())
				k=k0;
		return k;
	}
	public KartuSeluler cariKartuFavWanita(){
		KartuSeluler k=daftarKartu[0];
		for(KartuSeluler k0:daftarKartu)
			if(k.getjWanita()<k0.getjWanita())
				k=k0;
		return k;
	}
	public Provider cariProvFavPria(){
		Provider pMax=daftarProvider[0];
		for(Provider p:daftarProvider)
			if(pMax.hitungPenggunaPria()<p.hitungPenggunaPria())
				pMax=p;
		return pMax;
	}
	public Provider cariProvFavWanita(){
		Provider pMax=daftarProvider[0];
		for(Provider p:daftarProvider)
			if(pMax.hitungPenggunaWanita()<p.hitungPenggunaWanita())
				pMax=p;
		return pMax;
	}
}
This entry was posted in Kuliah, PBO. Bookmark the permalink.

41 Responses to Contoh Jawaban UTS PBO

  1. chanel store says:

    this chanel store is adorable, and they are incredibly style, so thats what I had been wanting these boots to really feel like.

  2. wow gold says:

    apple handful of match plus the are usually your fav!! they can fit far better using bluejeans then your short or simply high your when your denims won’t go over wow gold to make a person’s feet take a look great. but you just become every one of the ease in addition to fashionth along with wow gold as you grow aided by the other ones.

  3. gucci sale says:

    Sneak A Peek At THESE Guys

  4. trendy, not to mention fantastic, in addition to being cool. I may have assigned neverwinter astral diamonds the scoring.

  5. Why Not Find Out MORE

  6. d3 gold says:

    geez! as i [heart] the best d3 gold furthermore there very street fashion i personally take they all any time my family and i give your clients their opptinrty to successfully requirer and thus my friends and family members to generate d3 gold …

  7. Click To Investigate

  8. Hi!
    Others have voiced my confusion above, but it’s good sometimes to add to the melee. I’ve been signed up since the middle of January, but have three letters. They’re good letters! But similarly, I’d like to know if this is just the process from the dust settling or if this is to be expected?
    Thanks!

  9. Pingback: longchamp pas cher

  10. Pingback: supra pas cher

  11. Pingback: chaussure supra

  12. Pingback: wall stickers for bedrooms

  13. Pingback: nike shox pas cher

  14. Pingback: chaussure nike air max

  15. Pingback: air jordan 11 retro

  16. Pingback: basket air max pas cher

  17. I did so have enough money for previously when I seemed to be getting a additionally set of common talls (i had been acquiring buy neverwinter astral diamonds for navy) i actually experienced such at the cab end of your web page and i HAD to have buy neverwinter astral diamonds. should they were only available in of which box my best cardiovascular system dissolved and that i lost control for each other. they are really consequently nice and probably none sequin decreased from if your delight snow-storm got here they are really used only for us. Hence you need to take a risk and acquire them. i buy compliments on daily basis. Purchase Invest in Spend money on

  18. every time they last but not least got here, I had been alarmed. They will seemed to be which means that child like. Actually, I cannot including star trek online energy credits. They search love some thing purchase for the purpose of 17.00 money with regards to your adolescent good friends. Not really really worth such a significant charge. Many people also provide you with the very same comfort and ease, in addition to gentle, however the appear may the corporate Virtually no the legal.

  19. Pingback: supra pas cher

  20. Pingback: kids wall stickers

  21. Pingback: polo ralph lauren

  22. Pingback: air jordan homme pas cher

  23. psn says:

    This is a topic that is near to my heart… Thank you! Where are your contact details though?

Leave a Reply

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