# Hi i'm new to java....I need help to finish this calculation,can anyone help me.....

• 04-24-2011, 11:27 AM
double D
Hi i'm new to java....I need help to finish this calculation,can anyone help me.....
private class pcHandler implements ActionListener
{
public void actionPerformed(ActionEvent arie)
{
if(arie.getSource() == btnCalc)
{
double total = 0.0;
double price = 0.0;
int person = 0;

if(rbA.isSelected())
{
if(cbxA1.isSelected())
{
price = 5.00;
sit = 1;
}
else if(cbxA2.isSelected())
{
price = 5.00;
sit = 1;
}
else if(cbxA3.isSelected())
{
price = 5.00;
sit = 1;
}
}
if(rbB.isSelected())
{
if(cbxA1.isSelected())
{
price = 6.00;
sit = 1;
}
else if(cbxA2.isSelected())
{
price = 6.00;
sit = 1;
}
else if(cbxA3.isSelected())
{
price = 6.00;
sit = 1;
}
}
if(rbC.isSelected())
{
if(cbxA1.isSelected())
{
price = 7.00;
sit = 1;
}
else if(cbxA2.isSelected())
{
price = 7.00;
sit = 1;
}
else if(cbxA3.isSelected())
{
price = 7.00;
sit = 1;
}
}
if(rbD.isSelected())
{
if(cbxA1.isSelected())
{
price = 8.00;
sit = 1;
}
else if(cbxA2.isSelected())
{
price = 8.00;
sit = 1;
}
else if(cbxA3.isSelected())
{
price = 8.00;
sit = 1;
}
}
if(rbE.isSelected())
{
if(cbxA1.isSelected())
{
price = 6.00;
sit = 1;
}
else if(cbxA2.isSelected())
{
price = 6.00;
sit = 1;
}
else if(cbxA3.isSelected())
{
price = 6.00;
sit = 1;
}
}
if(rbF.isSelected())
{
if(cbxA1.isSelected())
{
price = 5.00;
sit = 1;
}
else if(cbxA2.isSelected())
{
price = 5.00;
sit = 1;
}
else if(cbxA3.isSelected())
{
price = 5.00;
sit = 1;
}
}
total = price * person;
txtTicket.setText("RM "+ price);
txtPerson.setText(" "+ person);
txtTP.setText("RM "+ total);
• 04-24-2011, 11:36 AM
sunde887
You didn't do anything but dump your code here, and you only dumped a random chunk.

Also, it's hard to read un formatted code, please wrap it in code tags.
[ code]. No space
[/code]

Finally, please ask a specific question. I am lazy, and others may be too, we don't want to spend time finding your small bugs. Please provide use with the necessary information.

Specific questions, exact error messages, etc.
• 04-24-2011, 11:56 AM
JosAH
I think this is a portion of the code from the question asked here. Please keep one thread for one question only.

kind regards,

Jos
• 04-24-2011, 12:06 PM
sunde887
Quote:

Originally Posted by JosAH
I think this is a portion of the code from the question asked here. Please keep one thread for one question only.

kind regards,

Jos

Wow, I said almost the same thing in both threads.