Kode Pulsa
/**
* Class Pulsa
*/
import java.util.Scanner;
public class Pulsa
{
private int nominal_pulsa_;
private int kode_provider_;
private String provider_;
private String nomor_hp_;
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 :");
nomor_hp_ = scan.next();
System.out.println("\n");
System.out.println("Masukkan Nominal Pulsa :");
nominal_pulsa_ = 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 : " + nomor_hp_);
System.out.println("Nominal : " + nominal_pulsa_);
System.out.println("Harga : " + (nominal_pulsa_ + 2000));
System.out.println("\n");
}
}
Komentar
Posting Komentar