Results 1 to 4 of 4
  1. #1
    double D is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default 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. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    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
    YOUR CODE HERE
    [/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. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,386
    Blog Entries
    7
    Rep Power
    20

    Default

    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
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Quote Originally Posted by JosAH View Post
    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.

Similar Threads

  1. Replies: 2
    Last Post: 04-23-2011, 03:27 PM
  2. how to finish this?
    By xpandaxlover in forum New To Java
    Replies: 2
    Last Post: 04-09-2010, 07:43 PM
  3. Finish Java Application
    By ojsimon in forum Jobs Offered
    Replies: 8
    Last Post: 12-07-2009, 04:25 PM
  4. Need help with doing a calculation in Java
    By John D. in forum New To Java
    Replies: 6
    Last Post: 02-24-2009, 11:44 PM
  5. RSSI calculation using Java Card STK....
    By vickytulla in forum Advanced Java
    Replies: 0
    Last Post: 07-14-2008, 08:56 AM

Posting Permissions

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