Berikut ini adalah salah satu contoh jawaban UTS PBO.
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 chanel store is adorable, and they are incredibly style, so thats what I had been wanting these boots to really feel like.
Look At This Site
Why Not Check Here
Hop Over To THIS WebSite
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.
Pop Over To This Website
ths
You Could Look Here
good share.
Sneak A Peek At THESE Guys
Go To This Website
Go To This Site
trendy, not to mention fantastic, in addition to being cool. I may have assigned neverwinter astral diamonds the scoring.
Why Not Find Out MORE
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 …
Try these guys out
Click To Investigate
Try This Out
Check These Guys Out
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!
Sneak A Peek HERE
Check this out
Look These Up
Try THIS Site
thanks for share!
Pingback: longchamp pas cher
good articles
Pingback: supra pas cher
Pingback: chaussure supra
Pingback: wall stickers for bedrooms
Pingback: nike shox pas cher
Pingback: chaussure nike air max
Pingback: air jordan 11 retro
Pingback: basket air max pas cher
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
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.
Pingback: supra pas cher
Pingback: kids wall stickers
Pingback: polo ralph lauren
Pingback: air jordan homme pas cher
This is a topic that is near to my heart… Thank you! Where are your contact details though?