Advertisement
Guest User

Untitled

a guest
Mar 31st, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1. package oop;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class OOP {
  6.  
  7. public static void main(String[] args) {
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. Scanner imr = new Scanner(System.in);
  15.  
  16. System.out.println(" Selamat datang di Gojek kawe! ");
  17. System.out.println(" Semoga anda puas menggunakan aplikasi ini! ");
  18. System.out.println("============================================");
  19.  
  20.  
  21. System.out.println("LOGIN");
  22.  
  23. System.out.print("Masukkan user : ");
  24.  
  25. String username=imr.nextLine();
  26.  
  27.  
  28.  
  29. System.out.print("Masukkan pass : ");
  30.  
  31. int password = imr.nextInt();
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. System.out.println("Silahkan pilih menu :");
  40.  
  41. System.out.println(" 1.Goride goride an ");
  42.  
  43. System.out.println(" 2.Gofood gofood an ");
  44.  
  45. System.out.println(" 3.Gosend gosend an ");
  46.  
  47. System.out.print("Masukkan pilihan : ");
  48.  
  49. int pilih = imr.nextInt();
  50.  
  51. switch(pilih){
  52.  
  53. case 1:
  54.  
  55. System.out.println("Anda memilih menu Goride silahkan pilih");
  56.  
  57. System.out.println("1.Kumaha maneh - Atuh weh");
  58.  
  59. System.out.println("2.Serah lu - Dah atur bae");
  60.  
  61. System.out.println("3.Karepmu - Gas gak rewel");
  62.  
  63. System.out.print("Masukkan pilihan : ");
  64.  
  65. int pilih1 = imr.nextInt();
  66.  
  67. switch(pilih1){
  68.  
  69. case 1:
  70.  
  71. Goride a =new Goride(" Kumaha maneh " , " Atuh weh " , 2000,7);
  72.  
  73. a.tampilGoride();
  74.  
  75. break;
  76.  
  77. case 2:
  78.  
  79. Goride b =new Goride(" Serah lu " , " Dah atur bae " , 2000 , 5);
  80.  
  81. b.tampilGoride();
  82.  
  83. break;
  84. case 3:
  85.  
  86. Goride c = new Goride(" Karepmu " , " Gas gak rewel " , 2000 , 3);
  87.  
  88. c.tampilGoride();
  89.  
  90. break;
  91. }
  92. break;
  93.  
  94. case 2:
  95.  
  96. System.out.println(" Anda memilih menu Gofood silahkan pilih : ");
  97. System.out.println( " 1.Chicken Honey Mustard " );
  98. System.out.println( " 2.Spaghetti Aglio Olio " );
  99. System.out.println( " 3.Roasted Quail Stuffed with Egg risotto " );
  100. System.out.print("Masukkan pilihan : ");
  101.  
  102. int pilih2 = imr.nextInt();
  103. switch(pilih2){
  104. case 1:
  105. Gofood a =new Gofood( " Chicken Honey Mustard " , 55000);
  106. a.tampilGofood();
  107. break;
  108.  
  109. case 2:
  110.  
  111. Gofood b =new Gofood( " Spaghetti Aglio Olio " , 59000);
  112. b.tampilGofood();
  113. break;
  114. case 3:
  115. Gofood c =new Gofood( " Roasted Quail Stuffed with Egg risotto " , 70000);
  116. c.tampilGofood();
  117. break;
  118. }
  119. break;
  120.  
  121. case 3:
  122.  
  123. System.out.println("Anda memilih menu Goride silahkan pilih");
  124. System.out.println( "1.Barang Aku ");
  125. System.out.println( "2.Barang Kamu ");
  126. System.out.println( "3.Barang Kita ");
  127. System.out.print("Masukkan pilihan : ");
  128.  
  129.  
  130. int pilih3 = imr.nextInt();
  131. switch(pilih3){
  132. case 1:
  133. Gosend a =new Gosend(" Barang Aku " , 5.5 , 1.28);
  134. a.tampilGosend();
  135. break;
  136. case 2:
  137. Gosend b =new Gosend(" Barang Kamu ", 5.5 , 2);
  138. b.tampilGosend();
  139. break;
  140. case 3:
  141. Gosend c =new Gosend(" Barang Kita ", 5.5 , 3.5);
  142. c.tampilGosend();
  143. break;
  144. }
  145. System.out.println("Terima Kasih telah menggunakan aplikasi ini :) ");
  146.  
  147.  
  148. package oop;
  149.  
  150. /**
  151. *
  152. * @author I Made Richard Putra
  153. */
  154. class Gosend {
  155. String nama;
  156.  
  157. double jarak,berat,biaya;
  158.  
  159. Gosend (String namaa,double jarakk,double beratt){
  160.  
  161. this.nama = namaa;
  162.  
  163. this.jarak = jarakk;
  164.  
  165. this.berat= beratt;
  166.  
  167. biaya=(berat*2000)+(jarak*1000)+2000;
  168.  
  169. }
  170.  
  171. void tampilGosend (){
  172.  
  173. System.out.println("Nama barang : "+nama);
  174.  
  175. System.out.println("Berat barang : "+berat+" kg");
  176.  
  177. System.out.println("Jarak kirim : "+jarak+" km");
  178.  
  179. System.out.println("Biaya order : "+biaya);
  180. }
  181. package oop;
  182.  
  183. /**
  184. *
  185. * @author I Made Richard Putra
  186. */
  187. class Gofood {
  188. String nama;
  189.  
  190. int harga,total;
  191.  
  192. int ongkir = 2000;
  193.  
  194. Gofood(String nama1,int harga1){
  195.  
  196. this.nama =nama1;
  197.  
  198. this.harga=harga1;
  199.  
  200. total=harga+ongkir;
  201.  
  202. }
  203.  
  204. void tampilGofood(){
  205.  
  206. System.out.println("Anda memilih "+nama);
  207.  
  208. System.out.println("Total order : "+total);
  209.  
  210.  
  211. }
  212.  
  213.  
  214. }
  215.  
  216. ackage oop;
  217.  
  218. /**
  219. *
  220. * @author I Made Richard Putra
  221. */
  222. class Goride {
  223. String lokasi;
  224.  
  225. String tujuan;
  226.  
  227. int biaya;
  228.  
  229. int total,jarak;
  230.  
  231. int ongkir=2000;
  232.  
  233. public Goride (String lokasii, String tujuann, int biayaa, int jarakk){
  234.  
  235. this.lokasi = lokasii;
  236.  
  237. this.tujuan = tujuann;
  238.  
  239. this.biaya = biayaa;
  240.  
  241. this.jarak =jarakk;
  242.  
  243. total = (biaya*jarak)+ongkir;
  244.  
  245. }
  246.  
  247. void tampilGoride(){
  248.  
  249. System.out.println("Lokasi anda :"+lokasi);
  250.  
  251. System.out.println("Lokasi tujuan :"+tujuan);
  252.  
  253. System.out.println("Biaya order :"+total);
  254.  
  255. }
  256.  
  257.  
  258. }
  259.  
  260.  
  261. }
  262.  
  263. }
  264. }
  265. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement