Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Class Pulsa
- */
- import java.util.Scanner;
- public class BeliPulsa
- {
- private int jumlahPulsa;
- private int kode_provider;
- private String provider;
- private String noHP;
- Scanner scan = new Scanner(System.in);
- public void beliPulsa()
- {
- System.out.println("Masukkan Provider");
- System.out.println("");
- System.out.println("1. Telkomsel");
- System.out.println("2. Indosat");
- System.out.println("3. 3");
- System.out.println("4. XL");
- kode_provider= scan.nextInt();
- switch(kode_provider)
- {
- case 1:
- provider = "Telkomsel";
- break;
- case 2:
- provider = "Indosat";
- break;
- case 3:
- provider = "3";
- break;
- case 4:
- provider = "XL";
- break;
- }
- System.out.println("Masukkan Nomor HP :");
- noHP = scan.next();
- System.out.println("\n");
- System.out.println("Masukkan Nominal Pulsa :");
- jumlahPulsa = scan.nextInt();
- printNota();
- }
- public void printNota()
- {
- System.out.println("\n");
- System.out.println("I-Kios");
- System.out.println("Pulsa");
- System.out.println("Provider : " + provider);
- System.out.println("Nomor : " + noHP);
- System.out.println("Nominal : " + jumlahPulsa);
- System.out.println("Harga : " + (jumlahPulsa + 2000));
- System.out.println("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement