i am currently using JCreator..
i came out wit these codes..>< can help add or correct?? i cant reli understand the while loop yet.
Quote:
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
public class Discount {
public static void main (String args []){
int DisCheap;
int DisExp ;
Double total ;
Double pricey;
String Input;
String output ;
DisCheap = 10;
DisExp = 15;
Input = JOptionPane.showInputDialog("Enter the price plz");
pricey = Double.parseDouble(Input);
DecimalFormat twoDigits = new DecimalFormat("0.00");
if (pricey <= 200.00){
total = (double)pricey / 100*DisCheap;
output = "Order Price RM"+twoDigits.format(pricey) + "\n Discounted amount RM"+twoDigits.format(total)+
"\nNet Price RM"+twoDigits.format(pricey -total);
JOptionPane.showMessageDialog(null,output,"Price",JOptionPane.INFORMATION_MESSAGE);
}
if (pricey >= 200.00){
total = (double)pricey / 100*DisExp;
output = "Order Price RM"+twoDigits.format(pricey) + "\n Discounted amount RM"+twoDigits.format(total)+
"\nNet Price RM"+twoDigits.format(pricey -total);
JOptionPane.showMessageDialog(null,output,"Price",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
}