A new dilema, code review for newbie

OK, now my dilema is taking input values from an applet and working them into my methods. I have read several tutorials, but I'm not finding any help. So far, I have written this code which does not complie (as expected). My methods seem solid, but my integration of the methods into an applet is far from decent. I have a feeling that I'm just going in circles here.
package membership;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.String;
public class MemberFee extends JApplet
String typeMem;
char memType;
int numKids,
numYears;
double memFee,
kFee,
iFee,
fFee,
totalFee;
boolean endProgram = false;
//DecimalFormat twoDigit = new DecimalFormat("0.00"); //page 171-172 in New Dietel Book
public void init ()
while (!typeMem == 'Q')
memType = JOptionPane.showInputDialog("Enter Type of Member: ");
typeMem = memType.charAt (0);
typeMem = Character.toUpperCase(typeMem);
if (typeMem == 'F')
numYears = JOptionPane.showInputDialog("Enter number of years:");
if(numYears<0)
JOptionPane.showMessageDialog(null,"Enter a positive value", "You have made an error", JOptionPane.ERROR_MESSAGE);
numKids = JOptionPane.showInputDialog("Enter number of kids:");
if(numKids<0)
JOptionPane.showMessageDialog(null,"Enter a positive value", "You have made an error", JOptionPane.ERROR_MESSAGE);
else
memFee = fFee;
JOptionPane.showMessageDialog (null, "Type of Member: " + "Years" +
"\nnumKids: " + (numKids) +
"\nnumYears: " + (numYears),
"Total", JOptionPane.PLAIN_MESSAGE);
else if (typeMem =='I')
numYears = JOptionPane.showInputDialog("Enter number of years:");
if(numYears<0)
JOptionPane.showMessageDialog(null,"Enter a positive value", "You have made an error", JOptionPane.ERROR_MESSAGE);
else
memFee = iFee;
JOptionPane.showMessageDialog (null, "Type of Member: " + "Years" +
"\nnumYears: " + (numYears),
"Total", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,JOptionPane.showMessageDialog (null, "Type of Member: " + "Years" +
"\nnumKids: " + (numKids) +
"\nnumYears: " + (numYears),
"Total", JOptionPane.PLAIN_MESSAGE));
}//end if
}//end while
//begin methods
//fee for individual method
public static double iFee(int numYears)
double memFee;
if (numYears >= 2)
memFee = 1500.00;
else
memFee = 1900.00;
return memFee;
// end individual method
//fees for family method
public static double fFee (int numYears, int numKids)
double memFee;
double kFee;
if (numKids <= 2)
kFee = 0.00 ;
else
kFee = (numKids * 250.00);
//end kids calculation
if (numYears >= 2)
memFee =2500.00;
else
memFee= 3000.00 + kFee;
return memFee;
//end family method
This is what I think my problems are:
1. I am confusing java application commands with java applet commands (shouldn't they be similar?)
2. Can applets even allow for pop up dialog boxes?
This problem keeps me up at night. Any help would be great.
THanks,

Hi,
probably you need learn more Java and start with small examples. I kind of fixed the compilation errors, but I don't know what the output might be. good luck.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.String;
public class MemberFee extends JApplet
     String typeMem;
     String memType;
     int numKids,
     numYears;
     double memFee,
     kFee,
     iFee,
     fFee,
     totalFee;
     boolean endProgram = false;
     //DecimalFormat twoDigit = new DecimalFormat("0.00"); //page 171-172 in New Dietel Book
     public void init ()
     while (!typeMem.equals("Q"))
     memType = JOptionPane.showInputDialog("Enter Type of Member: ");
     typeMem = memType.substring(0,0);
     typeMem = typeMem.toUpperCase();
     if (typeMem.equals("F"))
     numYears = Integer.parseInt(JOptionPane.showInputDialog("Enter number of years:"));
     if(numYears<0)
     JOptionPane.showMessageDialog(null,"Enter a positive value", "You have made an error", JOptionPane.ERROR_MESSAGE);
     numKids = Integer.parseInt(JOptionPane.showInputDialog("Enter number of kids:"));
     if(numKids<0)
     JOptionPane.showMessageDialog(null,"Enter a positive value", "You have made an error", JOptionPane.ERROR_MESSAGE);
     else
     memFee = fFee;
     JOptionPane.showMessageDialog (null, "Type of Member: " + "Years" +
     "\nnumKids: " + (numKids) +
     "\nnumYears: " + (numYears),
     "Total", JOptionPane.PLAIN_MESSAGE);
     else if (typeMem.equals("I"))
     numYears = Integer.parseInt(JOptionPane.showInputDialog("Enter number of years:"));
     if(numYears<0)
     JOptionPane.showMessageDialog(null,"Enter a positive value", "You have made an error", JOptionPane.ERROR_MESSAGE);
     else
     memFee = iFee;
     JOptionPane.showMessageDialog (null, "Type of Member: " + "Years" +
     "\nnumYears: " + (numYears),
     "Total", JOptionPane.PLAIN_MESSAGE);
     JOptionPane.showMessageDialog (null, "Type of Member: " + "Years" +
     "\nnumKids: " + (numKids) +
     "\nnumYears: " + (numYears),
     "Total", JOptionPane.PLAIN_MESSAGE);
     }//end if
     }//end while
     //begin methods
     //fee for individual method
     public static double iFee(int numYears)
     double memFee;
     if (numYears >= 2)
     memFee = 1500.00;
     else
     memFee = 1900.00;
     return memFee;
     // end individual method
     //fees for family method
     public static double fFee (int numYears, int numKids)
     double memFee;
     double kFee;
     if (numKids <= 2)
     kFee = 0.00 ;
     else
     kFee = (numKids * 250.00);
     //end kids calculation
     if (numYears >= 2)
     memFee =2500.00;
     else
     memFee= 3000.00 + kFee;
     return memFee;
//end family method

Similar Messages

  • A useful code Snippet - for newbies

    Hi All newbies
    Here is a use ful code snippet, for segregating values in a pipe delimited string.
    ArrayList arrayOfValues = new ArrayList();
    int startIdx=0;
    int endIdx=0;
    int loopIdx = 0;
    if (strStatus!= "") // The pipe de limited string
    while(true)
    endIdx = strStatus.indexOf('|', startIdx);
    if (endIdx <= 0)
    // No more entries
    arrayOfvalues.add(loopIdx++, strStatus.substring(startIdx));
    break;
    arrayOfValues.add(loopIdx++, strStatus.substring(startIdx, endIdx));
    startIdx = endIdx+1;
    for(int i=0;i<arrayOfValues.size();i++)
    System.out.println("elements in arraylist "+(String)arrayOfValues.get(i));
    Hope this is helpful
    All the best
    Swaraj

    While it's true that this will work (after the typos are corrected) I
    prefer something like this:     String strStatus="This|is|a|test";
         ArrayList arrayOfValues = new ArrayList();
         StringTokenizer st=new StringTokenizer(strStatus, "|");
         while(st.hasMoreTokens()) {
              arrayOfValues.add(st.nextToken());
         ListIterator li=arrayOfValues.listIterator();
         while(li.hasNext()) {
              System.out.println("Elements in ArrayList: "+(String)li.next());
         }Mark

  • New Tax code Creation for CST(Condition type

    Hi Friends,
    I am facing an issue during creation of new Tax-code for CST; condition type JIN1. After defining the tax percentage; system is picking an automatic G/L account, which is a grey field and can't be editable. We need to change G/L account and need to assign a new one.
    Can you please tell us how can we remove the default assigned and non-editable G/L account.
    Your support is appreciable.
    Rgds, Krishan Raheja.

    Hi Krishnan,
    Use transaction OB40, here double click on the Account Key (you can check this account key assigned to condition type in OBQ3 and also in FTXP screen) that is mapped to condition type JIN1 and enter your chart of accounts. Now change the G/L account you want.
    Regards,
    Chintan Joshi.

  • Update book inventory with NEW company code assignment for the same site

    Hi gurus ,
    Our company have this business scenario:
    the site has run in Company Code A for several month with business of Material Management  function, then the site have to be changed to Company Code B for financial requirement .
    What we want is we change the CC assignment by OX18 for site master without changing the site number (creating a new site master ),except for the open purchasing or  sales document clearance , is there any way we can update the book inventory  with new profit center corresponding to the CC B ?
    Thanks in advance ,
    Ryan

    Actually we have made some discussion with SAP consultant about this requirement ,and they suggest the same thing ,but for many reasons ,we need to make it that way ,and we also made some test for this direct changing by OX18  for new CC assignment .
    All other questions are  under control now , for financial reason ,we need to update the book inventory to new CC assignment (new profit center after site-specific material master changed ) in some batch session or program ,any idea for this?

  • Code Reviewer for OAF Code

    Hi All,
    Do we have a code review tool specially for OAF code something like JSTYLE is for java.
    Is there something specific to OAF or JSTYLE is ok to sue for OAF Code.
    Thanks,
    Arati

    Is there any tool for security review too for OAF

  • Code review for new coldfusion developer

    Hello all, my name's Oscar, and I've just created a little coldfusion framework for work to help us with some of our "legacy" systems (which all use a cms that bakes it's output.) And as I'm fairly new to coldfusion I wanted to see if you would mind quickly casting your eyes over what I've got and helping me improve my work with some of your hard earned experience.
    Everything I've got I've open sourced, and I've written an example application / readme with details about how to install it incase you want to try it out on your own system. I've a background in ruby, python, and php; so I've borrowed some conventions from frameworks like django and rails as I was building this, as well as dipping heavily into coldbox to get a better understanding of how to structure my cfml code.
    Here's the main repository for the project: https://github.com/binaryvision/pistachio.

    Hello all, my name's Oscar, and I've just created a little coldfusion framework for work to help us with some of our "legacy" systems (which all use a cms that bakes it's output.) And as I'm fairly new to coldfusion I wanted to see if you would mind quickly casting your eyes over what I've got and helping me improve my work with some of your hard earned experience.
    Everything I've got I've open sourced, and I've written an example application / readme with details about how to install it incase you want to try it out on your own system. I've a background in ruby, python, and php; so I've borrowed some conventions from frameworks like django and rails as I was building this, as well as dipping heavily into coldbox to get a better understanding of how to structure my cfml code.
    Here's the main repository for the project: https://github.com/binaryvision/pistachio.

  • BAdI code review - for perfomance improvements

    Hi,
    I've a BAdI implementation to enhance a BW datasource which will extract additional fields for the datasource. The pseudo code for the extractor is as below. Can some one please review and let me know the opportunities (which I'm sure there will be) to improve the performance of the BAdI?
    Thanks a lot.
    Regards,
    Sri.
    Pseudo Code:
    loop at ct_data assigning <ls_data>.
      case <on_a_field>.
        when <value_1>.
           if <condition1>.
           elseif<condition2>.
           elseif<condition3>.
           endif.
        when <value_2>.
           <execute a function module by exporting value_2>        
           if <condition1>.
           elseif<condition2>.
           elseif<condition3>.
           endif.
      endcase.
    <extraction logic for other fields continue>
    endloop.

    Hi
    Two suggestions:
    First, use tcode ST05 to do traces and diagnose the bottleneck.
    Second, tcode ABAP_TRACE, go to tips and tricks, and in internal tables /  using the assigning command see samples and run them to evaluate the times. But in my opinion you are doing well.
    I hope this helps you
    Regards
    Eduardo

  • Code Review Tools for Enhancements

    Friends,
    I have to perform code review for enhancement objects. I am aware of tools like Code Inspector (SCI Tcode) and SE30. These tools can be used for reports, function modules.
    I would like to know if these tools can be used for enhancements or are there some other tools available?
    Thanks and Regards.

    Hi
    can you work on :
    1) ST05 Performance Trace
    2) ST03G Global Statistical Records
    STAD Statistical Records
    3) ST30 Global Performance Analysis
    thnak you
    srinu

  • UK Payroll new tax code 1000L

    Hello Friends:  
    In UK Payroll new tax code 1000L for year 2014-April 06th.  I have updated in Constant table V_T511K effective April 06th 2014 but this code is not going to Ceridian interface(PU12).  I would like to know where we need to apply this new tax code?.  Is there any OSS Notes?. Any help is appreciated. Thanks in Advance

    Hello
    Please note that the tax calculation for UK payroll is done based on the tax code as maintained in IT0065 ,.
    Also please note the following :-
    Code 0T u2013 This code is used cumulatively with no pay adjustment and all pay is taxed according to the relevant rate dependent on the level of earnings
    Code BR  - This code means that all the employeesu2019 pay is liable to basic rate tax and there is no pay adjustment allowed
    Tables T5G01 and T5G02 are then used by payroll for tax calculation.
    Hope this helps
    Kind Regards
    Ramana

  • Oracle Apps secure code review

    Is any documentation available (either Oracle or third party based) to guide secure code reviews for Oracle Apps (or more specifically, Oracle Application Framework)?
    I'm aware of the usual sql injection bad practices (as related to JDBC and PLSQL). I'm curious about API abuse, as related to:
    - cross-site scripting concerns
    - client-side trust issues (e.g., hidden field values)
    - improper or inconsistent input validation
    - improper error handling
    - improper session management
    - inappropriate access control
    Thanks.

    Thanks... I looked at that and didn't think it was all in there, but I looked again after I got your reply and it appears to be what we are looking for (at least a starting point).

  • Code Review:: ADF BC applications

    Hi,
    We would like to know if there's any open source software available for code reviews of ADF applications and how to effectively use to for ADF BC applications?
    1) Am I moving in right direction while exploring PMD and Checkstyle? Are these the right candidates for setting automated code reviews for ADF applications?
    Is there a specific software recommendation by the forum members which can help me achieve this goal.
    2) Can CodeCoach and Audit features available in JDeveloper help me in this?
    3) Will I have to necessary create 'Custom Rules' for tasks like validating EO classes are not directly referred in the Controller? Are there some pre-built rule-sets available on this front?
    4) Any other suggestions for ensuring better/faster code reviews not necessarily replacing the manual peer review process but reducing the unnecessary headaches that can be fixed by freely available software
    Sid

    I started using ADFLogger and added some log statements. When I ran my application in JDeveloper in Embeded OC4J server, these log statements are appearing in JDeveloper server log window. After I deployed this application to Oracle Application Server, these statements are not appearing in the application.log file and also not in any file. Am I missing any configuration setting? The log current level is INFO and I do have few INFO statements, SEVERE statements in my code. Thanks in advance.

  • Code Review tool of Angular Js ??

    Hi All,
    I need to do code review for all of my Angular JS files
    Please let me know if any tool is available for doing review of my JS files 
    I am aware of ReSharper tool and planning to use the same for my requirement.
    Thanks in Advance 
    -Jiniv Thakkar

    Hi Zpittman,
    What is you said ‘Code Review Tool’?
    I assume that you meant the Code Review feature in TFS. I tried it in Visual Studio 2013 with update 4 and TFS 2013 with Update 4, the whitespace was detected and the code review see it as a difference.
    If you don’t get the same result with me using VS and TFS, please upgrade your VS and TFS to the latest update.
    If the issue still exists, please
    reset your VS settings through Tools->Import and Export settings->Reset all
    settings->…. and repair your VS.
    If code review tool is a third-party tool or a third-party VS/TFS add-in, the official support of this tool can be a better place to resolve your issue.
    If I misunderstood anything, please feel free to come back.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error " Data missing for the entry check while creating a new waste code

    Hi all, While setting a new Waste code I get the error " Data missing for the entry check, correction:". while filling the NAM- WASTECOCAT - LER item.
    This sould look for the catalog's name included in the phrase set but for some reason it doesn't find it giving me this error.
    I am changing original Characteristics, phrase set, classes, and value assignment type. Just to have my own estructure with Znames for all of them.
    I have also change the enviroment parameter "WAM_PHRSET_WACATLG" with the name of my phrase set.
    I have checked everything several times watching for typos or looking for a missing step.
    I have even tried including my new Z's characteristics in the classe and living the original SAP_EHS_1024_001_WASTE_CATALOG. (changing the enviroment parameter WAM_PHRSET_WACATLG to SAP_EHS_1024_001_WASTE_CATALOG) and it works.
    I will like to change this characteristic by Z_EHS_WA_WASTE_CATALOG
    Phrase set to Z_EHS_WA_WASTE_CATALOG.
    enviroment parameter WAM_PHRSET_WACATLG= Z_EHS_WA_WASTE_CATALOG
    After matching up the master data It should work fine but I might be missing something to get it running ok.
    ¿Any idea?
    Regards,
    Alvaro

    Hello Juan Carlos, the value and class that I want to duplicate and doesn't work is for Waste Code, I have also duplicated the one you have displayed (waste pproperties) without any problem.
    1.I have duplicated and changed class SAP_EHS_1024_001. to Z_EHS_WA
    2. Create a copy of the 5 characteristics included in this class.
    SAP_EHS_1024_001_WASTE_CATALOG
    SAP_EHS_1024_001_WASTE_CODE
    SAP_EHS_1024_001_WA_SUBCATEG
    SAP_EHS_1024_001_WA_CATEGORY
    SAP_EHS_1024_001_REMARK
    change the name by
    Z_EHS_WA_WASTE_CATALOG
    Z_EHS_WA_WASTE_CODE
    Z_EHS_WA_SUBCATEG
    Z_EHS_WA_CATEGORY
    Z_EHS_WA_REMARK.
    I checked the funcion C14K_WASTECATLG_CHECK is in the value of the Z_EHS_WA_WASTE_CODE characteristic
    I checked the funcion C14K_WASTECODE_CHECK is in the value of the Z_EHS_WA_WASTE_CATALOG characteristic
    3. Create phrase sets for each new category. with same name.
    4. Match up the master data.
    5. Change the enviroment parameter.to Z_EHS_WA_WASTE_CATALOG
    I think I have followed all the steps, but for some reason it doesn't find the catalog
    The phrase for the catalog is EWC in english and LER in spanish.
    Regards
    Alvaro.

  • Error while creating sales order for a new company code

    Hello SD Gurus,
    The client wanted us to create a new Company Code, Plant, and Sales Organization. We created them. I extended the customer and material in QAS. Now, I'm trying to create one sales order in QAS but the system is throwing one error: "Maintain Profit Center Value in Custom Table in YSD_PROFIT_CNTR".
    I googled for this error but found nothing. Could you please give me the solution asap. I need to prepare test script.
    Thanks in advance
    Regards,
    Anwar

    Dear Mohammed,
    The error message itself states where is the issue. You need to maintain the profit center in table
    YSD_PROFIT_CNTR. This is not SAP Standard provided solution. I guess during the time of implementation team has suggested to maintain the profit center in custom table.
    If the table is"maintenance view" then you can check through SM30 and maintain the relevant entry. If not check if there is any transaction code with attached to this table. This you can check by going through SE93 and by entering Z* or ZSD* or Y* or YSD* and press F4, If the transaction code is starting with Z or Y it will open all the list of transaction codes. By going through the description of the transaction code. you can pick the right transaction code in case if any exists for this table.
    Hope this information is useful to you.
    Regards
    Murali

  • Creation of new T.Code for customization update

    Dear All,
    As per standard SAP, the below given configuration need to maintain directly in production system (not through transport).
    SPRO -
    > Logistics - General ---> Tax on Goods Movements ---> India ---> Master Data ---> Assign Users to Material Master Screen Sequence for Excise Duty ---> User screen reference
    The above cofiguration update the view V_USRM0_R. However as per my client policy, changes (configuration change) are not allowed directly in production system. All configuration change should be through SAP transprot. Also the view is not possible to maintain by T.code - SM30(since it is a cross client & we don't allow to chanage any cross client data). The above change we use quite frequently.
    Is it possible to create new T.Code for maintaining the above data? Mean to say, a new enhancement for maintaining view V_USRM0_R.
    Your input should be highly appreciated.
    Regards,
    sp sahu

    I got the answer

Maybe you are looking for

  • GL account in cost estimate

    Hi, For Standard cost estimate the GL account will be pick from Cost component strucutre OKTZ. We are fine here Can you please tell me how the sales order cost estimate will take GL and where it will store value. we are in MTO scenario and posting CO

  • Transforming XML into nested Internal Table via Call Transformation XSLT

    Hi guys! I am relatively new to this XML transformation to Abap Internal table. Hence I got help some help from this thread ABAP Development as well as referencing Txn SSTDEMO1 and SSTDEMO2 But I tried to attempt on my prog it failed. Heres my sample

  • Re: getting the file name from a dynamic web server

    On a related note, how do I get the information from the: URLConnection.getContent () method? I mean I create URL object, then I create a URLConnection object by doing the following from my URL object (urlObject): URLConnection con = urlObject.openCo

  • Emails are not being sent on Document sharing

    Hi everyone, I have a created a documnt library and made it available for users. The issue is that emails are not being sent when a user creates/Uploads a document and share it with other users. Please refer below screenshot. Further, emails from app

  • Exporting Hyperion Business Rules as Text files

    Hyperion 9.3.1 installtion... Does anyone have any nifty scripts or techniques for getting the HBR code out into flat files (ideally named as the Rule)... I Know you can export via AAS, but all I want is the raw code so I can use some differencing to