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

1. Member
Join Date
Apr 2011
Posts
2
Rep Power
0

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);

2. 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.

3. 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

4. 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.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•