Advertisement
Guest User

fdgsksd

a guest
Jul 16th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. /**
  2. Nama : Imam Mashur
  3. Kelas : XII TKJ 1
  4. NIS : 2011113
  5.  
  6. buatlah program utk menghitung rata2 menggunakan konsep pemrograman berorientasi objek
  7. */
  8. public class rata2 {
  9. double jumlah;
  10. public void inputData(int data)
  11. {
  12. jumlah = data;
  13. }
  14. double hrgWxp; //harga windows xp
  15. double winXP() //objek windows xp
  16. {
  17. return hrgWxp = 290000;
  18. }
  19. double hrgW7; //harga windows 7
  20. double win7() //objek windows 7
  21. {
  22. return hrgW7 = 565000;
  23. }
  24. double hrgW8;
  25. double win8()
  26. {
  27. return hrgW8 = 999000;
  28. }
  29. public static void cetak() {
  30. System.out.print("harga rata-rata windows di kaskus ialah ");
  31. }
  32. double ratata = winXP()+win7()+win8();//Pengolahan rata-rata
  33. public void nilai() {
  34. System.out.println(ratata);
  35. }
  36. public static void main(String[] args)
  37. {
  38. rata2 ratax=new rata2();
  39.  
  40. ratax.inputData(3);
  41. ratax.cetak();
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement