Kak

Len - kun snifsnif I love you ! Why u be mean and hate me !!!!!!!! TwT ~ mikuchan ps . I am so not the best singer , if I had a choice , I wouldnt want all these fans and anyway , they only like me because I was the first vocaloid . GOMENE LEN- KUNI !!!! GOMENE !!!! PLEASE DO N'T HATE ME DOUKA DO N'T KIARI ME !!!!!!!!!!!! ILEHEN- KOOOONNNN DOUKA !!!!!! HE !! IDN
just fuc of natter..............................
KAK IS LIKE JESUS CHRIST KAK DIED FOR YOUR SINS NATTER AND YOU ARE ALL HEATHENS
XD
XD
X
D
XD
XD
D
D
X
D
D
D
XD
X
D
X
D
X
D
ZD
XD
XD
XD
XD
XD
DD
XD
XD
XD
XD
DD
XD
XD
XD
XD
XD
XD
XD
XD
XD
XD
XD
Pangloss: Could you give me directions to the Olive Garden?
Candide: No, but we can cultivate our own garden.
Pangloss: package invoiceapp;
import javax.swing.*;
import java.awt.*;
import java.awt.color.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.text.*;
import javax.swing.border.*;
public class InvoiceApp extends JFrame implements ActionListener
{
JButton b1; //calculation button
JButton exit; //ends the program
JButton clear; //resets all variables and text to 0.
JTextField inSubtotal; //text box for subtotal input
JLabel lSubtotal; //subtotal label
JLabel lDiscPerc; //discount percentage label
JLabel lDisc; //discount label
JLabel lTotal; //grand total label
DecimalFormat twoDForm = new DecimalFormat("####0.00"); //makes sure variables will always display with 2 decimals.
double discPercVar; //value of discount percentage
double discVar; //value of discount
double totalVar; //value of grand total
public InvoiceApp()
{
setTitle("Invoice Total Calculator");
setSize(200, 180);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//gets dimensions of the monitor and puts the program in the center of the screen
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
int width = 200;
int height = 180;
setLocation((d.width - width)/2, (d.height - height)/2);
//registers all buttons in the jframe
clear = new JButton("Clear");
b1 = new JButton("Calculate");
exit = new JButton("Exit");
//registers buttons with the action listener
clear.addActionListener(this);
b1.addActionListener(this);
exit.addActionListener(this);
//Assigns inSubtotal as a text field
inSubtotal = new JTextField(10);
//Creates main pane of the jframe
Container content = getContentPane();
content.setLayout(new BorderLayout());
content.setBackground(Color.white);
//Creates a pane for the fields
JPanel pFields = new JPanel();
//jlabels for displaying data, doubles are limited to 2 decimals
lSubtotal = new JLabel("Subtotal: ");
lDiscPerc = new JLabel("Discount Percent: " + twoDForm.format(discPercVar));
lDisc = new JLabel("Discount: $" + twoDForm.format(discVar));
lTotal = new JLabel("Invoice Total: $" + twoDForm.format(totalVar));
//sets the pane to flow layout
pFields.setLayout(new FlowLayout());
//adds all fields to the pane
pFields.add(lSubtotal);
pFields.add(inSubtotal);
pFields.add(lDiscPerc);
pFields.add(lDisc);
pFields.add(lTotal);
//creates pane for buttons
JPanel pButtons = new JPanel();
pFields.setLayout(new FlowLayout());
//adds buttons to pane
pButtons.add(clear);
pButtons.add(b1);
pButtons.add(exit);
//nests the field and button panes in to the main pane.
content.add(pFields, BorderLayout.CENTER);
content.add(pButtons, BorderLayout.SOUTH);
}//end InvoiceApp
//button push protocols
public void actionPerformed(ActionEvent ae)
{
try //checks for exceptions
{
Object source = ae.getSource();
if(source == clear) //when clear button is pressed
{
//dumps all values in to the abyss
inSubtotal.setText("");
discPercVar = 0;
discVar = 0;
totalVar = 0;
//applies changes to the display
this.lDiscPerc.setText("Discount Percent: " + twoDForm.format(discPercVar));
this.lDisc.setText("Discount: $" + twoDForm.format(discVar));
this.lTotal.setText("Invoice Total: $" + twoDForm.format(totalVar));
}
if(source == exit)//when exit button is pressed
{
System.exit (o) ; //ends the program
}
if (source==b1)//if calculate is pressed
{
//converts inSubtotal in to a double
String inString= inSubtotal.getText();
double subTotalVar= Double.parseDouble(inString);
//depending on the value of subtotal...
if(subTotalVar >= 200.00)
{//if the subtotal is greater than $200, then the discount is 20%
discPercVar = 0.20;
}
else if(subTotalVar >= 100.00 && subTotalVar 
{//If it is instead greater than or equal to $100, but less than $200 it will be a 10% discount
discPercVar = 0.10;
}
else
{//If its lower than $100 there is no discount
discPercVar = 0.00;
}
discVar = subTotalVar * discPercVar; //calculate discount
discVar = Math.round(discVar*100.00)/100.00; //rounds it to 2 decimals
totalVar = subTotalVar - discVar; //subtracts the discount from the subtotal to get the grand total
totalVar = Math.round(totalVar*100.00)/100.00; //rounds it to 2 decimals
//applies changes to the display
this.lDiscPerc.setText("Discount Percent: " + twoDForm.format(discPercVar));
this.lDisc.setText("Discount: $" + twoDForm.format(discVar));
this.lTotal.setText("Invoice Total: $" + twoDForm.format(totalVar));
//resets variables to 0 behind the scenes to make sure they don't interfere with later calculations
discPercVar = 0;
discVar = 0;
totalVar = 0;
}//end if
}//end try
catch(NumberFormatException eb)//if math cannot be performed with whatever is in the text box
{
if(inSubtotal.getText().isEmpty())
{//if it is because there is no text in the box
JOptionPane.showMessageDialog(
null,
"no input data was entered",
"alert", JOptionPane.ERROR_MESSAGE);
}
else
{//if it is because you entered something other than a number
JOptionPane.showMessageDialog(
null,
"entered an invalid number - " + inSubtotal.getText(),
"alert", JOptionPane.ERROR_MESSAGE);
}
}
}//end actionperformed
public static void main(String[] args)
{
InvoiceApp fl = new InvoiceApp();
fl.setVisible(true);
}
}