Oiyhi

Only available on StudyMode
  • Topic: Optional Practical Training
  • Pages : 13 (1423 words )
  • Download(s) : 75
  • Published : February 13, 2013
Open Document
Text Preview
Q.
Design a GUI to calculate total bill amount for a shop if
1) Price per shirt is 120, price per trouser is 100 & price per cardigan is 220. 2) Discount is calculated as on the basis of payment mode :- a)credit = 0% b)cash- more than 10000 = 12%

b/w 7000 & 10000 = 10%
less than 7000 = 5%

Solution:-
private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) { // TODO add your handling code here:
if(jCheckBox1.isSelected())
{
jTextField1.setEditable(true);
jTextField1.setText(null);
jTextField2.setText(""+120);
}
else
if(jCheckBox1.isSelected()==false)
{
jTextField1.setEditable(false);
jTextField1.setText("0");
jTextField2.setText(""+0);
}
}

private void jCheckBox2ItemStateChanged(java.awt.event.ItemEvent evt) { // TODO add your handling code here:
if(jCheckBox2.isSelected())
{
jTextField3.setEditable(true);
jTextField3.setText(null);
jTextField4.setText(""+100);
}
else
if(jCheckBox2.isSelected()==false)
{
jTextField3.setEditable(false);
jTextField3.setText(""+0);
jTextField4.setText(""+0);
}
}

private void jCheckBox3ItemStateChanged(java.awt.event.ItemEvent evt) { // TODO add your handling code here:
if(jCheckBox3.isSelected())
{
jTextField5.setEditable(true);
jTextField6.setText(""+220);
jTextField5.setText(null);
}
else
if(jCheckBox3.isSelected()==false)
{
jTextField5.setEditable(false);
jTextField6.setText(""+0);
jTextField5.setText(""+0);
}
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
int a,b,c=0;
a=Integer.parseInt(jTextField7.getText());
b=Integer.parseInt(jTextField8.getText());
c=a-(a*b/100);
jTextField9.setText(""+c);

Private void jRadioButton2ItemStateChanged(java.awt.event.ItemEvent evt) { // TODO add your handling code here:
if(jRadioButton2.isSelected())
jTextField8.setText("0");
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
int a,b,c,d,e,f,g=0;
a=Integer.parseInt(jTextField1.getText());
b=Integer.parseInt(jTextField2.getText());
c=Integer.parseInt(jTextField3.getText());
d=Integer.parseInt(jTextField4.getText());
e=Integer.parseInt(jTextField5.getText());
f=Integer.parseInt(jTextField6.getText());
g=(a*b)+(c*d)+(e*f);
jTextField7.setText(""+g);
jRadioButton1.setEnabled(true);
jRadioButton2.setEnabled(true);
}

Private void jRadioButton1ItemStateChanged(java.awt.event.ItemEvent evt) { // TODO add your handling code here:
int t;
t=Integer.parseInt(jTextField7.getText());
if(jRadioButton1.isSelected())
{
if(t>10000)
jTextField8.setText("12");
else
if(t>7000 && t<=10000)
jTextField8.setText("8");
else
if(t<=7000)
jTextField8.setText("5");
}
else...
tracking img