Tax Calulator applet again pls help urgent

why isn't it possible to pass a string and a double into GetResult below, i get a compilation error and right now i dunno how to proceed. GetRelief is supposed to calculate "relief" from textfields i/p and GetResult is suppose to calculate the "result" (minus "relief" from GetRelief). And is it the correct way to create an object as in calc = new Calculate(); below................any help would be greatly appreciated...
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class TaxCal extends Applet implements ActionListener {
     private TextField income, age, child, parent, course, maid, pay;
     private Button b2, b3;
     private Calculate calc;
     public void init() {
               setBackground(Color.lightGray);
               /* Create the input boxes, and make sure that the background
               color is white. (On some platforms, it is automatically.) */
               income = new TextField(10);
               Panel incomePanel = new Panel();
               incomePanel.setLayout(new BorderLayout(2,2));
               incomePanel.add( new Label("Input your annual income"), BorderLayout.WEST );
          incomePanel.add(income, BorderLayout.CENTER);
               age = new TextField(2);
               Panel agePanel = new Panel();
               agePanel.setLayout(new BorderLayout(2,2));
               agePanel.add( new Label("Input your age"), BorderLayout.WEST );
               agePanel.add(age, BorderLayout.CENTER);
               child = new TextField(2);
               Panel childPanel = new Panel();
               childPanel.setLayout(new BorderLayout(2,2));
               childPanel.add( new Label("Number of children"), BorderLayout.WEST );
               childPanel.add(child, BorderLayout.CENTER);
               parent = new TextField(1);
               Panel parentPanel = new Panel();
               parentPanel.setLayout(new BorderLayout(2,2));
               parentPanel.add( new Label("Number of parent that live with you"), BorderLayout.WEST );
               parentPanel.add(parent, BorderLayout.CENTER);
               course = new TextField(5);
               Panel coursePanel = new Panel();
               coursePanel.setLayout(new BorderLayout(2,2));
               coursePanel.add( new Label("Course fee"), BorderLayout.WEST );
               coursePanel.add(course, BorderLayout.CENTER);
               maid = new TextField(5);
               Panel maidPanel = new Panel();
               maidPanel.setLayout(new BorderLayout(2,2));
               maidPanel.add( new Label("Maid levy paid"), BorderLayout.WEST );
               maidPanel.add(maid, BorderLayout.CENTER);
               pay = new TextField(10);
               pay.setEditable(false);
               Panel payPanel = new Panel();
               payPanel.setLayout(new BorderLayout(2,2));
               payPanel.add( new Label("Please pay"), BorderLayout.WEST );
               payPanel.add(pay, BorderLayout.CENTER);
               Panel buttonPanel = new Panel();
               buttonPanel.setLayout(new GridLayout(1,3));
               Button b2 = new Button("Reset");
               b2.addActionListener(this);     // register listener
               buttonPanel.add(b2);
               Button b3 = new Button("Calculate");
               b3.addActionListener(this);     // register listener
               buttonPanel.add(b3);
               /* Set up the layout for the applet, using a GridLayout,
          and add all the components that have been created. */
          setLayout(new GridLayout(8,2));
               add(incomePanel);
               add(agePanel);
               add(childPanel);
               add(parentPanel);
          add(coursePanel);
          add(maidPanel);
          add(payPanel);
          add(buttonPanel);
          /* Try to give the input focus to xInput, which is
          the natural place for the user to start. */
          income.requestFocus();
          } // end init()
     public TaxCal() {
     calc = new Calculate();
     public Insets getInsets() {
// Leave some space around the borders of the applet.
     return new Insets(2,2,2,2);
     // event handler for ActionEvent
     public void actionPerformed (ActionEvent e) {
          String s = e.getActionCommand();
          if (s.equals("Calculate"))
               double relief = calc.GetRelief(age.getText(), child.getText(), parent.getText(), course.getText(), maid.getText());
               double result = calc.GetResult(income.getText(), relief);
               pay.setText(Double.toString(relief));
          else
               income.setText("");
               age.setText("");
               child.setText("");
               parent.setText("");
               course.setText("");
               maid.setText("");
               pay.setText("");
}     // end actionPerformed()
public class Calculate
private double result;
private double incomeTotal;
private double ageTotal;
private double childTotal;
private double parentTotal;
private double courseTotal;
private double maidTotal;
private double relief;
public Calculate()
relief = 0.0;
result = 0.0;
incomeTotal = 0;
ageTotal = 0;
childTotal = 0;
parentTotal = 0;
courseTotal = 0;
maidTotal = 0;
public double GetResult(String theincome, Double therelief)
     incomeTotal = Double.parseDouble(theincome);
     relief = therelief;
     incomeTotal =- relief;
     if (incomeTotal <= 7500)
     result = incomeTotal * .02;
     else if (incomeTotal > 7500 && incomeTotal <= 20000)
     result = 150 + ((incomeTotal - 7500) * .05);
     else if (incomeTotal > 20000 && incomeTotal <= 35000)
     result = ((incomeTotal - 20000) * .08) + 775;
     else if (incomeTotal> 35000 && incomeTotal <= 50000)
     result = ((incomeTotal - 35000) * .12) + 1975;
     else if (incomeTotal > 50000 && incomeTotal <= 75000)
     result = ((incomeTotal - 50000) * .16) + 3775;
     else if (incomeTotal > 75000 && incomeTotal <= 100000)
     result = ((incomeTotal - 75000) * .2) + 7775;
     else if (incomeTotal > 100000 && incomeTotal <= 150000)
     result = ((incomeTotal - 100000) * .22) + 12775;
     else if (incomeTotal > 150000 && incomeTotal <= 200000)
     result = ((incomeTotal - 150000) * .23) + 23775;
     else if (incomeTotal > 200000 && incomeTotal <= 400000)
     result = ((incomeTotal - 200000) * .26) + 35275;
     else if (incomeTotal > 400000)
     result = ((incomeTotal - 400000) * .28) + 87275;
     return result;
public double GetRelief(String theage, String thechild, String theparent, String thecourse, String themaid)
     ageTotal = Double.parseDouble(theage);
     parentTotal = Double.parseDouble(theparent);
     maidTotal = Double.parseDouble(themaid);
     childTotal = Double.parseDouble(thechild);
     courseTotal = Double.parseDouble(thecourse);
                         //determine age relief
                         if(ageTotal<55)
                         relief += 3000;
                         else if(ageTotal>=55 && ageTotal<= 59)
                         relief += 8000;
                         else
                         relief += 10000;
                         //determine children relief
                         if(childTotal<=3)
                         relief += (childTotal*2000);
                         else if(childTotal>3 && childTotal<6)
                         relief += ((childTotal-3)*500 + 6000);
                         else
                         relief += 0;
                         //determine parent relief
                         if(parentTotal == 1)
                         relief += 3000;
                         else if(parentTotal ==2)
                         relief += 6000;
                         else
                         relief += 0;
                         //determine course subsidy
                         if(courseTotal != 0 ) {
                              if(courseTotal <= 2500)
                              relief += courseTotal;
                              else
                              relief += 2500;
                         //determine maid levy
                         if(maidTotal != 0) {
                              if(maidTotal <= 4000)
                              relief += 2 * maidTotal;
                              else
                              relief += 0;
return relief;
} // end of class Calculate
}      // end class TaxCal

You're probably not getting anything to show up because in your actionPerformed() method, b3 has not been initialized.
You declare static variables:
Button b2, b3;
but then in your init() method, you delare new local variables when you specify:
Button b2 = new Button(...);
Button b3 = new Button(...);
Since you're declaring and initializing the new local variables, you have never set the static variables to any values. Try removing the type declaration for b2 and b3 in your init() method as follows:
b2 = new Button(...)
b3 = new Button(...)
Hope this helps!

Similar Messages

  • How do I delete my old iMessage email and change to my current one, that Im using when I buy apps and so on. The old one wont go away when I turn iMessage on and of again. pls help

    How do I delete my old iMessage email and change to my current one, that Im using when I buy apps and so on. The old one wont go away when I turn iMessage on and of again. pls help
    Anyone had the same?

    How do I delete my old iMessage email and change to my current one, that Im using when I buy apps and so on. The old one wont go away when I turn iMessage on and of again. pls help
    Anyone had the same?

  • I've used firefox for a month now but recently if I type on facebook the quick find search bar pops out. Even if I press Esc, when i type on facebook again the quick find bar pops out again. pls help..

    I've used firefox for a month now but recently if I type on facebook the quick find search bar pops out. Even if I press Esc, when i type on facebook again the quick find bar pops out again. pls help..
    even when i click the register on the top right of mozilla it wont allow me to.

    I've used firefox for a month now but recently if I type on facebook the quick find search bar pops out. Even if I press Esc, when i type on facebook again the quick find bar pops out again. pls help..
    even when i click the register on the top right of mozilla it wont allow me to.

  • File to File Scenario with Secure Connection. Pls help urgent

    Hello All,
    I tried a lot to get a link/blog that expalin full scenario
    for File to File Scenario with Secure Connection
    Kindly let me know if somebody have link/doc for it
    that describe all the steps to do configuring this scenario.
    What is difference in simple words between
    FTPS and SFTP.
    Pls help it is urgent as I require for Project work urgently.
    Regards

    hi rich
    go through these links
    FTPs connection failed - error ".. certificate rejected by ChainVerifier"
    Re: What is SFTP, FTI channels
    http://help.sap.com/saphelp_erp2005/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm
    FTPS implementation question.
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/0e16bfd7b021aee10000000a1553f6/frameset.htm
    Server certificate rejected by ChainVerifier:FTPS server(Points Guaranteed)
    /people/krishna.moorthyp/blog/2007/07/31/sftp-vs-ftps-in-sap-pi
    File adapter
    thanks
    Kunaal

  • PSE12 recognises my scanner, however, asks to connect??!! Pls HELP urgently

    Hello
    I have win7pro and win 8.1. PSE12 recognises my scanner, however, after going through and pressing scan it comes up with a error to coonnect the device!! The printer scanner is a HP Officejet 6500a plus if this helps.
    Pls advise urgently.

    Download and install this: http://support.apple.com/kb/DL907
    Restart your Mac.
    Reset the printing system:
    - Go to System Preferences > Print & Scan
    - Right (or control) click in the rectangle listing your printers and select Reset Printing System.
    WARNING - this will delete ALL of your printers!
    - Select the plus sign to re-add a printer. Select the Defualt tab on the top of the window. Look for the printer, select it and then next to the "Use" pulldown, select the printer model (not AirPrint). Wait until the "Add" button becomes available. Click it.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Issue when doing Delta loads from PSA to DSO using DTP - Pls help Urgent

    Hi All,
    I have done 3 data loads into PSA and from PSA, iam loading the data into DSO - by splitting that load into 3 using 3 DTPs. (Split that by Fiscal Period).
    2 of the DTP loads are extracting the data from 3 PSA requests.
    But, one of the DTP load is filtering on ONE PSA request.
    So, we are not getting the full data into DSO.
    Can some one pls help me why the DTP load is beheaving like this ???
    Even though i have not given any filters for Request id, still , for one load its picking up the data by filtering on One Req ID.
    Cheers,
    Nisha

    Hi Jr,
    Sorry for late reply.
    I think i found the solution, the diff between the DTP's is i ahve ticked " Get request one after another " .
    I have changed it now and its working fine.
    Thanks,
    Nisha

  • CALL Transaction in background not working pls help URGENT

    hi i have writtin a bdc program which uses CALL TRSANCTION everything is working in foreground.
    if i schedule the program in background the call transaction does not work. any idea why?????????
    pls help its urgent

    hi
    good
    have you checked in the debug mode, if you have checked in the debug mode check wheather it is giving any error before data is displaying in the screen, if any error is displaying as a message than check that error why it is coming there.
    If no error is coming than check your flow of the bdc screen in the debug mode , there must be some prob, so that it is not working in the background.
    thanks
    mrutyun^

  • Music wont download - pls help urgently

    i have tried 5 times to download an album from itunes and every time i have to re-renter my billing details and double check everything is correct but to no avail. after doing this, there's no downloaded music and i don't know if apple will charge me 5 times as well for trying (hopefully not!!). pls help me. thanks

    Yes, I have, i think it may have something to do when
    it says, "playlist selected for updating no longer
    exists"
    But making a new playlist didnt work
    Then you didn't name it exactly the same as the ones that were deleted. It WILL work. Been there, done that.
    Good luck!

  • Cannot use face time after upgrating to ios 6 .password is not recognisible.pls help urgently

    I cannot use face time after updating to IOS 6'password  is not recognisible here nor to imessage pls help urgently

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime: Set-up, Use, and Troubleshooting Problems
    http://tinyurl.com/32drz3d
     Cheers, Tom

  • Pls help, urgent... I'm giving out all my duke dollars...

    Hi, thanks for reading...
    My problem is I need to assignment some value into an variable when the "main" program start and I want the data inside this variable visible to all the class to use (by using the getter methods to get the value),
    For example: From the code below (the clsMain), it is possible to get the same value assigned into the "strGrandChildName" variable in the "main" program inside the "clsChild" class? Any idea how to make this thing work? pls help me... with some sample code... i really appreciate any help you guys can give.
    Thank You,
    Best Regards.
    public class clsGrandChild {
    private String strGrandChildName = "";
    public void mtd_setGrandChildName(String strIn) {
    strGrandChildName = strIn;
    public String mtd_getGrandChildName() {
    return strGrandChildName;
    public class clsChild {
    private String strChildName = "";
    public void mtd_setChildName(String strIn) {
    strChildName = strIn;
    public String mtd_getChildName() {
    return strChildName;
    public String mtd_GrandChildName() {
    // can i get the same value of strGrandChildName assigned in the main frm here?
    public class clsMain extends clsGrandChild {
    public static void main(String[] args) {
    mtd_setGrandChildName("grand child name");
    clsChild objChild = new clsChild();
    objChild.mtd_GrandChildName();

    public class clsGrandChild {
    private String strGrandChildName = "";
    public void mtd_setGrandChildName(String strIn) {
    strGrandChildName = strIn;
    public String mtd_getGrandChildName() {
    return strGrandChildName;
    public class clsChild {
    private String strChildName = "";
    public void mtd_setChildName(String strIn) {
    strChildName = strIn;
    public String mtd_getChildName() {
    return strChildName;
    public String mtd_GrandChildName() {
    // can i get the same value of
    alue of strGrandChildName assigned in the main frm
    here?
    public class clsMain extends clsGrandChild {
    public static void main(String[] args) {
    mtd_setGrandChildName("grand child name");mtd_setGrandChildName("grand child name") shouldn't be called here, it should be called after the
    clsChild object has been created
    >
    clsChild objChild = new clsChild();objChild. mtd_setGrandChildName("grand child name");
    objChild.mtd_GrandChildName();
    If to access the variable strGrandChildName before the instanciation of clsChild object is what you needed, then you will need to set the string strGrandChildName as static and also setter method
    needs to be static too.
    private static String strChildName = "";
    public static void mtd_setGrandChildName(String strIn) {
    strGrandChildName = strIn;
    by doing it this way, the static variables will be created when main thread starts.

  • Lost a shortcut for one of my apps but the app is on my phone when i go into the app store under purchased how do i create a shortcut again, pls help iphone 4

    lost a shortcut for one of my apps but it shows up in the app store as purchased how do I get the shortcut back, pls help iphone 4

    Hi newyorker2014,
    I apologize, I'm a bit unclear on the exact nature of your issue. If you are no longer seeing the app in question on your iPhone, but it is showing as purchased on the App Store, you should be able to redownload it directly. You may find the following article helpful:
    Download past purchases
    http://support.apple.com/kb/ht2519
    Regards,
    - Brenden

  • Error in generating the condition table.. pls help urgent

    Hi all,
    I have some condition tables to be generated in CRM from ECC.
    i am getting the following error for 2 tables : " Generation for application CRM, Usage PR and table CUS601 failed".
    But other tables data has been corectly downloaded from ECC to CRM.
    I m checking the status in SLG1. and i use tcode : CND_MAS_GEN_OBJECTS.
    Kindly help me this,
    its very very urgent.
    points will be rewarded.
    Robin

    thanks rajesh for ur reply.
    Basically the issue is like this now.
    Im trying to download the confition tables data from R3 to CRM. so in CRM...
    when i manually try to start initial download the object for a table by R3AS, tcode..
    the bdocs are been in intermeditate state in CRM. with yellow.
    when i try to reprocess it is throughing a short dump( reason telling : already a record is been availble in table : CNLCRMPRSCALEDIM, trying to insert again.
    So m not understanding what the issue would be..
    Could you please help me with this. im really in dead situation.
    it is working for other tables
    Robin

  • N96-phone recovery-PLS HELP--URGENT

    im geting the error in nokia software updater:-
    remove the battery and charger,
    insert battery and charger,
    click retry
    power on.
    what should i do?
    after trying this, i still get the error!
    help pls
    What's Worth Doing, Is Worth Doing Well!
    All "N-series" are incredible!

    You better keep truing as instructed. you you completely exit the update program you wont be able to recovr your nokia anymore.
    IVOR you shouldn't advise people who's update went wrong to disconnect it and reinstall the program! This way they will never be able to recover the Phone.
    I just updated my n96 and it went wrong too. the only thing the phone did when i turned it on was flashing with the back light and back off again and again. The only way you can fix your faulty update is to do exactly as told in the software.
    First put back in the USB cable then the battery and then the charger. then press the on/off button for 1 sec. then retry on the program
    If you do this right you wont see anything happen to your phone.. it stays black and wont start up. on your computer screen you wont see that the phone has been reconnected. But now the update bar of the nokia updater will go on. and finish the update and try to recover the phone. When its finished the phone will start up and go into test mode. after the test is complete it will startup.
    I once had the problem that the telephone hang on test mode and it still was after 10 minutes. if this happens pull out the usb cable and instantly put it back in. this way the usb will be reconnected to your computer and the phone will finish the test.
    NEVER I SAY NEVER ! force quit the update program when the phone is off and the update has failed. As the phone is still in the standby menu while updating then there is not much that can happen. for it has not began updating yet.

  • PRD Client L.ocked -   Pls Help Urgent.

    Hi Gurus,
      Yesterday i set remote copy for PRD To DEV in background job.  Now the Job is cancelled.  The PRD Client is locked.  If i login " The client is currently locked against logon"  - This is error message display all users.  Pls advise how to unlock the client.
    This is very urgent..
    Thanks
    Rajesh.

    Hi Rajesh,
    useful link
    http://www.sap-img.com/bc060.htm
    you can unlock client from if you have access to any of the client in that system
    We can lock a client using SCCR_LOCK_CLIENT and unlock SCCR_UNLOCK_CLIENT functions.
    even you can user tp command to unlock
    hope this helps,
    thanks
    kishore

  • CFloop in Javascript function...pls help urgent

    <script type="text/Javascript">
          function XYZ(group_id)
           switch(group_id)
            <cfloop query = "GetProgramAuthGrpRouting">
             case '#GetProgramAuthGrpRouting.group_id#':
              <cfset variables.user_names = "">
              <!--- Get all users belonging to the selected group id --->
              <cfquery name="GetGroupUsers" datasource="#request.db_instance#">
               select distinct employee_number from dbo.DIV_USER_GROUP_XREF where division =
                <cfqueryPARAM value = "#request.Pub.Project.division#"> and group_id =
                <cfqueryPARAM value = "#GetProgramAuthGrpRouting.group_id#">
              </cfquery>
              <!--- Getting the name of the user by passing the employee id to the GetUser custom tag  --->
              <cfif GetGroupUsers.RecordCount gt 0>
               <cfloop query = "GetGroupUsers">
                <CF_GetUser
                 query_name = "GetUser"
                 employee_number = "#GetGroupUsers.employee_number#">
                <cfset variables.user_names = variables.user_names&''&GetUser.employee_name&'\n'>
               </cfloop>
              <cfelse>
               <cfset variables.user_names = 'No users in this routing group\n'>
              </cfif>
                alert('#variables.user_names#');
                break;
              </cfloop>
         </script>
    Hi all I am new to this community and this is my first post here. So if this is the wrong place for these then pls let me know the right area. Thanks.I have looped over the result set using CFLOOP in  javascript function and it is working fine. But I want to know if this can be done since javascript is a client side scripting language and CF is a server side. Is this the right way of coding? Can i use cfloop in a javascript function? Please help me as this is urgent. Thanks in advance.

    You you can use CFML inside of a JavaScript <script..> block to dynamically build the JavaScript code to send to the client.  It is a very powerful technique for building highly interactive web sites.
    Just realize that all the JavaScript code is going to be completely built by the CFML and then sent to the browser client through the web server where the JavaScript is executed completely independent of anything that is running on the server.  The JavaScript can not read or write variables on the server or vice-a-versa.  But it is quite easy to export variable values from ColdFusion to JavaScript.  It is a bit more work to export variable values back requiring either the browser or JavaScript to make a new request of the server to send the data.  AJAX does allow this to happen behind the scenes making it look like the data is being shared.  But in reality it is being passed back and forth with independent HTTP requests and responses.
    A recent discussion on this topic:
    http://forums.adobe.com/message/1957350#1957350

Maybe you are looking for

  • Eprint error creating account: Ajax submit failed: error = 403, Forbidden

    I am trying to create an eprint account. but when I hit submit I get: Ajax submit failed: error = 403, Forbidden I am running from a mac with OSX 10.8. And a new HP Photosmart 6515. The browser is Safari version 6.0. I've tried different namse, scree

  • Field Symbol has not been assigned

    Hi, While billing I am getting this ABAP runtime error and it says Error in ABAP application program. The current ABAP program "SAPLV60B " had to be terminated because one of the statements could not be executed. This is probably due to an error in t

  • Unable to switch back to laptop screen with xrandr from VGA

    HI, I'm using i3 window manager and have an external display plugged in sometimes. I use the following short script to turn off the laptop display and turn on the vga monitor xrandr --output VGA1 --auto xrandr --output LVDS1 --off xrandr --output VGA

  • Query between two Datatables

    Hello I'm very new to using Datasets and Datatables so forgive my ignorance; I have extensively searched through the forums but am having problems working out the best way forward. I have two Datatables in an application which are derived from an SQL

  • Urgent:Job Status

    Hi, I scheduled a load to cube.. In SM37 it says Job Finished.. But at monitor it is still in yellow.. Does it take time? At status tab I have 20 Data packets and the last 10 r in green and the first 10 r in yellow..whatis the reason? Even the data h