-->

Source Code Java Perhitungan Diskon pada Setiap Jenis Barang dgn Nilai yang Berbeda-beda

This time I will make a post about how to enter the discount input on an item payment, this time the post continues from my previous post Calculating the Number of Scanner Prices. This post is related to the following question:

1. If the total purchase is more than IDR 50,000, you can get a 5% discount
2. If the total purchase is more than IDR 100,000, you can get a 10% discount
3. If the total purchase is more than IDR 200,000, a 15% discount can be obtained
4. If the number of items purchased from is equal to 50 units, then an additional discount will be obtained as much as 5%

The steps are as follows:

1. Run the NetBeans Application, if you don't have a download here, NB needs a JDK if you don't have it here yet

2. After the application opens, it will appear as shown below and choose NEW PROJECT (Ctrl + Shift + N).


3. After that will appear like the example image below, Select Foleder Java> Java Application> Click Next

Source Code Java Perhitungan Diskon pada Setiap Jenis Barang dgn Nilai yang Berbeda-beda

After that, specify the LOCATION for storing your project file and TITLE your project then click Finish


Source Code Java Perhitungan Diskon pada Setiap Jenis Barang dgn Nilai yang Berbeda-beda

4. Write the input "import java.util.Scanner;" under the discount package;




5. Enter the Input just below "// TODO code application logic here" as shown below

int jml, hrg, ttl, discount;
      Scanner scan = new Scanner (System.in);
      System.out.println ("Input Amount:");
      jml = scan.nextInt ();
      System.out.println ("Enter Price:");
      hrg = scan.nextInt ();
      ttl = jml * hrg;
    
      if (ttl> = 200000) {
            discount = ttl * 15/100;
            ttl = ttl - discount;
            System.out.println ("Discount = 15%");
      } else if
            (ttl> = 100000) {
            discount = ttl * 10/100;
            ttl = ttl - discount;
            System.out.println ("Discount = 10%");
      } else if
            (ttl> = 50000) {
            discount = ttl * 5/100;
            ttl = ttl - discount;
            System.out.println ("Discount = 5%");
      }
      if (jml> = 50) {
          discount = ttl - ((ttl * 5) / 100);
          System.out.println ("Add 5% Discount \ n Total Pay =" + discount);
      }
      else {
          System.out.println ("Total Pay = Rp." + Ttl);
      }

Source Code Java Perhitungan Diskon pada Setiap Jenis Barang dgn Nilai yang Berbeda-beda


8. After that we test by pressing the F6 key on the keyboard (Make sure the input source code is written correctly and there are no errors).
After that we input the numbers on the output tab


Lihat Juga Source Code lainnya dibawah ini  :


NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post

Composure

 

Delivered by FeedBurner

-->