https://github.com/dmlloyd/openjdk
okay on this occasion I will make a simple cashier application with java programming language on netbeans, in this program the key is the implementation of the If-else conditional, the program is very easy to understand because we do not insert many object comparison in it, but if you already understand about this program you can certainly modify this program to be more complete.
import java.util.*;
public class NewClass
{
public static void main(String args [])
{
Scanner barang=new Scanner (System.in);
int amount, unit_price, price, total_price;
double discount;
System.out.print("\nEnter the amount of goods purchased : ");
amount=barang.nextInt();
System.out.print("\nEnter Unit Price : ");
unit_price=barang.nextInt();
price = amount * unit_price;
System.out.print("\nTotal price of goods : "+price);
if (price > 1000000)
{
discount = (double) price * 0.1;
total_price= price-(int)discount;
}
else if (price>500000 || price >=1000000)
{
discount = (double) price * 0.05;
total_price= price-(int)discount;
}
else
{
discount= (double) price * 0;
total_price= price-(int)discount;
}
System.out.print("\n\nDiskon sebesar : " +discount);
System.out.print ("\n\nThe price to pay is Rp " +total_price);
}
}
import java.util. *; because we use the input scanner method or input method directly from the NetBeans base window without displaying a new window like input JOptionPane which uses classimport javax.swing. *;.public class NewClass we here make the name for the file is NewClass so we must equate with the name of the program.public static void main (String args []).Scanner item = new Scanner (System.in);int amount, unit_price, price, total_price;
double discount;
System.out.print("\nEnter the amount of goods purchased : ");
amount=barang.nextInt();
System.out.print("\nEnter Unit Price : ");
unit_price=barang.nextInt();
price = amount * unit_price;
System.out.print("\nTotal price of goods : "+price);
if (price > 1000000)
{
discount = (double) price * 0.1;
total_price= price-(int)discount;
}
else if (price>500000 || price >=1000000)
{
discount = (double) price * 0.05;
total_price= price-(int)discount;
}
else
{
discount= (double) price * 0;
total_price= price-(int)discount;
}
System.out.print("\n\nDiskon sebesar : " +discount);
System.out.print ("\n\nThe price to pay is Rp " +total_price);
Include a list of related tutorials you have already shared on Utopian that make up a Course Curriculum, if applicable.
https://gist.github.com/andilapulga/8b2391e8cf50a10cfce89ca1a0f625b8