Plaes help me with CAT2 tx-code

Hi Friends,
I have enhnced 4 custom fields(Columns) in CAT2 tx-code. Can you please help me where i have to write the code to save the
data in database.
Thanks in advance.
Subhaskar

First create an enhancement project with transaction CMOD, add the enhancement in it and activate the project, only then will the customer-exit be called.
- Read some documentation on [Customer Exits|http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975a043b111d1896f0000e8322d00/frameset.htm] like [Customer Exits (CMOD)|http://wiki.sdn.sap.com/wiki/display/ABAP/CustomerExits%28CMOD%29]
- Read the enhancement documentation in transaction SMOD before starting debug, or read online documentation like [SAP Enhancements and Business Add-Ins|http://help.sap.com/erp2005_ehp_02/helpdata/en/bd/53fa2fcc43594dbf9f406c18989a47/frameset.htm] in [Technical Background Information of the Time Sheet|http://help.sap.com/erp2005_ehp_02/helpdata/en/bd/53fa2fcc43594dbf9f406c18989a47/frameset.htm]
You must read the Enhancement documentation, cause you may be required to perform some Customizing. (SPRO, Cross-Application Components, Time Sheet, Settings for All User Interfaces, Customer-Specific Modifications)
Regards,
Raymond

Similar Messages

  • Please! help me with this wrong code, where is mistake

    please! help me with this wrong code, where is mistake?
    import java.util.Stack;
    public class KnightsTour {
    Vars locs[];
    private int size, max=1, d=0, board[][];
    public KnightsTour(int x,int y, int newSize)
         size=newSize;
         locs=new Vars[size*size+1];
         for(int n=1;n<=size*size;n++)
              locs[n]=new Vars();
         board=new int[size+1][size+1];
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   board[n][n2]=0;
         locs[max].x=x;
         locs[max].y=y;
         locs[max].d=1;
         board[x][y]=max;
         max++;
    class Vars{
         int x;
         int y;
         int d;
    public void GO()
         int n=0;
         while(max<=size*size)
              n++;
              d++;
              if(d>8)
                   max--;
                   board[locs[max].x][locs[max].y]=0;
                   d=locs[max].d+1;
              move();
         printBoard();
    public void move()
         int x=locs[max-1].x, y=locs[max-1].y;
         switch(d)
         case 1:x--;y-=2;break;
         case 2:x++;y-=2;break;
         case 3:x+=2;y--;break;
         case 4:x+=2;y++;break;
         case 5:x++;y+=2;break;
         case 6:x--;y+=2;break;
         case 7:x-=2;y++;break;
         case 8:x-=2;y--;break;
         //System.out.println(" X: "+x+" Y: "+y+" |"+max);
         if((x<1)||(x>size)||(y<1)||(y>size)){}
         else if(board[x][y]!=0){}
         else
              locs[max].x=x;
              locs[max].y=y;
              locs[max].d=d;
              board[x][y]=max;
              max++;
              d=0;
              //printBoard();
    public void printBoard()
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   if(board[n2][n]<10)
                        System.out.print(board[n2][n]+" ");
                   else
                        System.out.print(board[n2][n]+" ");
              System.out.println();
         //System.out.println();
         System.out.println();
         public static void main (String[]args){
              KnightsTour k = new KnightsTour(1,1,8);
         }

    public class KnightsTour {
        Vars locs[];
        private int size,  max = 1,  d = 0,  board[][];
        public static void main (String[] args) {
            KnightsTour k = new KnightsTour (1, 1, 8);
            k.GO ();
        public KnightsTour (int x, int y, int newSize) {
            size = newSize;
            locs = new Vars[size * size + 1];
            for (int n = 1; n <= size * size; n++) {
                locs[n] = new Vars ();
            board = new int[size + 1][size + 1];
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    board[n][n2] = 0;
            locs[max].x = x;
            locs[max].y = y;
            locs[max].d = 1;
            board[x][y] = max;
            max++;
        class Vars {
            int x;
            int y;
            int d;
        public void GO () {
            int n = 0;
            while (max <= size * size) {
                n++;
                d++;
                if (d > 8) {
                    max--;
                    board[locs[max].x][locs[max].y] = 0;
                    d = locs[max].d + 1;
                move ();
            printBoard ();
        public void move () {
            int x = locs[max - 1].x, y = locs[max - 1].y;
            switch (d) {
                case 1:
                    x--;
                    y -= 2;
                    break;
                case 2:
                    x++;
                    y -= 2;
                    break;
                case 3:
                    x += 2;
                    y--;
                    break;
                case 4:
                    x += 2;
                    y++;
                    break;
                case 5:
                    x++;
                    y += 2;
                    break;
                case 6:
                    x--;
                    y += 2;
                    break;
                case 7:
                    x -= 2;
                    y++;
                    break;
                case 8:
                    x -= 2;
                    y--;
                    break;
    //System.out.println(" X: "x" Y: "y" |"+max);
            if ((x < 1) || (x > size) || (y < 1) || (y > size)) {
            } else if (board[x][y] != 0) {
            } else {
                locs[max].x = x;
                locs[max].y = y;
                locs[max].d = d;
                board[x][y] = max;
                max++;
                d = 0;
    //printBoard();
        public void printBoard () {
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    if (board[n2][n] < 10) {
                        System.out.print (board[n2][n] + " ");
                    } else {
                        System.out.print (board[n2][n] + " ");
                System.out.println ();
    //System.out.println();
            System.out.println ();
    }formatting ftw.
    If you call GO () you get in an infinite loop. max gets decreased, and it loops while max is smaller then or equal to size * size. Is your looping logic correct ?

  • Hi folks, can someone help me with my redemption code? have a creative cloud id made last week. but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me??? Thank you

    Hi folks, can someone help me with my redemption code?
    have a creative cloud id made last week.
    but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me???
    Thank you

    I have a fully companies annual subscription of 69.99 a month.
    but I can only download the 30-day trial versions.
    and if I want to put on them completely firedamp should I enter a redemption code. could it be that the code later emailed word?
    Met vriendelijke groet,
    Dave Dros
    Van: "hans-g." <[email protected]<mailto:[email protected]>>
    Beantwoorden - Aan: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Datum: dinsdag 21 oktober 2014 10:03
    Aan: iMac <[email protected]<mailto:[email protected]>>
    Onderwerp:  Hi folks, can someone help me with my redemption code? have a creative cloud id made last week. but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me??? Thank you
    Hi folks, can someone help me with my redemption code? have a creative cloud id made last week. but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me??? Thank you
    created by hans-g.<https://forums.adobe.com/people/hans-g.> in Adobe Creative Cloud - View the full discussion<https://forums.adobe.com/message/6850359#6850359>

  • Help needed with part of code

    Hi all,
    Need some advice on how to write part of this code to print cost and retail!SEE ASTERISKS**
    I know its smoething to with this part of code:-
    System.out.println("Part No." +"\t"+ "Quantity." +"\t"+ "Cost Price." +"\t"+ "Retail Price.");
    System.out.println(input_part +"\t"+ "\t" + qty[input_part-1] + "\n");
    Just dont know how to add the cost and retail to printout!!
    Any help appreciated
    Paul
    import java.io.*;
    import B102.*;
    public class ass2{
    public static void main(String[] args) throws IOException{
    char more='y';
    while(more=='y'){
    int i;
    int numrecords = 0; int size = 0;
    int quantity = 0;int input_part = 0;
    String line;
    String filename;
    int qty[];     
    int partno[];
    double cost[];
    double retail[];
    // Get the name of the input file
    System.out.print("Enter the name of the input file: ");
    filename = Keybd.in.readLine();
    // Open the file for reading
    BufferedReader in = new BufferedReader(new FileReader(filename));
    // read the first line of the file to determine the size of the array
    line = in.readLine();
    numrecords = Integer.parseInt(line.trim());
    // create the qty array with the inputed size
    qty = new int[numrecords];
    partno = new int[numrecords];
    cost = new double[numrecords];
    retail = new double[numrecords];
    /* Read part numbers */
    for(i = 0; i < numrecords; i++){
    line = in.readLine();
    partno[i] = Integer.parseInt(line.trim());
    /* Read cost price */
    for(i = 0; i < numrecords; i++) {
    line = in.readLine();
    cost[i] = Double.parseDouble(line.trim());
    /* Read retail price */
    for(i = 0; i < numrecords; i++){
    line = in.readLine();
    retail[i] = Double.parseDouble(line.trim());
    /* Read quantity */
    for(i = 0; i < numrecords; i++){
    line = in.readLine();
    qty[i] = Integer.parseInt(line.trim());
    // close the file
    try{
    in.close();
    }catch (IOException iox){
    System.out.println("problem closing input file");
    // the file is now closed
    System.out.print("Enter part number: ");
    input_part = Keybd.in.readInt();
    // get a quantity
    System.out.print("Enter quantity: ");
    quantity = Keybd.in.readInt();
    // test if there is sufficient stock, if not print message
    if(quantity > qty[input_part-1])
    System.out.println("Not enough stock!");
    else
    System.out.println("Stock level: "+qty[input_part-1]);
    //output contents of arrays
    for(i=0;i<numrecords;i++){
    System.out.print(partno[i]+"\t");
    System.out.print(cost[i]+"\t");
    System.out.print(retail[i]+"\t");
    System.out.print(qty[i]+"\t");
    System.out.println();
    // output
    System.out.println("You entered part number: "+input_part);
    System.out.println("You entered quantity: "+quantity);
    System.out.println("Part No." +"\t"+ "Quantity." +"\t"+ "Cost Price." +"\t"+ "Retail Price.");
    System.out.println(input_part +"\t"+ "\t" + qty[input_part-1] + "\n");
    System.out.println("Do you wish to make another purchase? (y) for yes or any other key to quit.");
    more=Keybd.in.readChar();

    2 things:
    1. Always surround your code with [ code] [ /code] blocks (without the spaces) - otherwise no one can read what you are doing.
    2. Will the following work for you? From your description it is pretty much impossible to tell what you are actually having problems with...
    System.out.println("Part No." +"\t"+ "Quantity." +"\t"+ "Cost Price." +"\t"+ "Retail Price.");
    System.out.println(input_part +"\t"+ "\t" + qty[input_part-1] + "\t" + cost[input_part-1] + "\t" + retail[input_part-1] + "\n");

  • Can sumone help me with this promo code question?

    I got a promo code and I entered it but the itunes music store says that this code as already been used. I haven't used the code and would like to know how to redeem my credits.

    Just FYI, everyone here is just a fellow user; no one here (with very rare exeptions) works for Apple. Everyone here helps out of the goodness of their hearts and as they have time and knowledge.
    So have patience when you post; it's very unlikely that you'll get a response within just a couple of minutes, and in some cases it may take hours for someone to see your question who has suggestions to offer. So please don't post back again (unless you're adding details to your question) for at least a few hours, and better not for a day or so, and definitely don't post back on a few minutes after your first post. That's just going to annoy people and make them less likely to want to help you.

  • Pros help needed with post data code

    i needed to change the code below to post the userAnswer from radio button group,  to an ASPX page so i can read the data in and post it to a database. can anyone help. thanks
    btnCheck.addEventListener(MouseEvent.CLICK, checkAnswer);
    function checkAnswer(evt:MouseEvent):void {
    userAnswer = String(rbg.selectedData);
        messageBox.text =  userAnswer + " has been clicked";

    //Create the loader object
    var prodloader:URLLoader = new URLLoader ();
    //Create a URLVariables object to store the details
    var variables: URLVariables = new URLVariables();
    //Createthe URLRequest object to specify the file to be loaded and the method ie post
    var url:String = "url here";
    var prodreq:URLRequest = new URLRequest (url);
    prodreq.method = URLRequestMethod.POST;
    prodreq.data = variables;
    function submitHandler(event:Event):void {
        variables.productId = whatever;
        prodloader.load(prodreq);
        btnSubmit.addEventListener(MouseEvent.CLICK, submitHandler);
        function contentLoaded(event:Event):void {
           //Stuff here
            prodloader.addEventListener(Event.COMPLETE, contentLoaded);

  • Please help me with this ABAP code!

    Here is my code:
    ===
    REPORT ZCFICO6010
             line-count 65
             line-size 132
             no standard page heading.
    tables: zsopshist, zsops.
    data: old_prezsops like zsops_prev.     "PJCHG10854
    data: new_prezsops like zsops_prev.     "PJCHG10854
    data: old_zzsops like zsops.            "PJCHG10854
    data: new_zzsops like zsops.            "PJCHG10854
    data: long_rec(900) type c.             "PJCHG10854
    data: old_lzsops like long_rec.         "PJCHG10854
    data: new_lzsops like long_rec.         "PJCHG10854
    data: curr_zsops like zsops,
          prev_zsops like zsops_prev.
    data: begin of i_key,
      kostl(5),
      aedat(8),
      cputm(6).
    data:   end of i_key.
    DATA: HEADER like zsops-oprcd,
          header1(92) type c.
        header1 like header.
    data: v_field(18) type c,
          v_old(20)  type c,
          v_new(20)  type c,
          user like zsops-uname,
          date like zsops-aedtm.
    data: begin of table occurs 0,
          text(20) type c,
          oprcd like zsops-oprcd,
          field(15) type c,
          user like zsops-uname,
          date like zsops-aedtm,
          v_old(20) ,
          v_new(20) ,
        end of table.
    data: text(30) type c.
    data: begin of itab occurs 0,
           srtfd like zsopshist-srtfd,
         end of itab.
    *data: ihist like old_zsops occurs 0 with header line,
         nhist like new_zsops occurs 0 with header line.
    data: ihist like zsops occurs 0 with header line,
          nhist like zsops occurs 0 with header line.
    *&      Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE TEXT-200.
    parameters: s_oprcd  like zsops-oprcd obligatory,
                s_oprcdh like zsops-oprcd .
                    s_cputm   for sy-uzeit.
    SELECTION-SCREEN END OF BLOCK one.
    SELECTION-SCREEN BEGIN OF BLOCK three WITH FRAME TITLE TEXT-300.
    parameters:s_aedtm  like zsops-aedtm obligatory,
    s_aedtmh like zsops-aedtm obligatory.
    SELECTION-SCREEN END OF BLOCK three.
    SELECTION-SCREEN BEGIN OF BLOCK TWO WITH FRAME TITLE TEXT-100.
    PARAMETERS: P_REGSRT RADIOBUTTON GROUP RADI,
                P_ACCSRT RADIOBUTTON GROUP RADI.
    SELECTION-SCREEN END OF BLOCK TWO.
    parameters: new_date like sy-datum obligatory default '20051214'.
    *&      Top-Of-Page
    top-of-page.
    BEGIN OF BLOCK INSERTED FOR                              "JJMM20040330
      DATA: CC_LOW LIKE ZSOPS-OPRCD,
            CC_HIGH LIKE ZSOPS-OPRCD,
            FROM_DATE(10) TYPE C,
            TO_DATE(10)   TYPE C.
      WRITE: S_OPRCD TO CC_LOW NO-ZERO,
             S_AEDTM TO FROM_DATE USING EDIT MASK '__/__/____',
             S_AEDTMH TO TO_DATE USING EDIT MASK '__/__/____'.
      IF S_OPRCDH = S_OPRCD.
        CONCATENATE: 'Cost Center'(T02) CC_LOW 'Changed On'(T04) FROM_DATE
                     'To'(T03) TO_DATE 'Sort By'(T05) text INTO HEADER1
                     separated by space.
      ELSE.
        WRITE: S_OPRCDH TO CC_HIGH NO-ZERO.
        CONCATENATE: 'Cost Center'(T02) CC_LOW 'To'(T03) CC_HIGH
                     'Changed On'(T04) FROM_DATE 'To'(T03) TO_DATE
                     'Sort By'(T05) text INTO HEADER1 separated by space.
      ENDIF.
    END OF BLOCK INSERTED FOR                                "JJMM20040330
      PERFORM DISPLAY_PAGE_HEADER(ZCLT0001) USING
                                          header1            "JJMM20040330
                                            HEADER
                                            TEXT-T01
                                            header1.           "JJMM20040330
      Write:/ 'Field Changed'(C01), 25 'Old Values'(C02),
               55 'New Values'(C03), 85 'Cost Center'(C04),
              105 'Changed By'(C05), 120 'Changed On'(C06).
      uline.
    start-of-selection.
      data: time(6),
            v_subrc like sy-subrc,
            prev_format(1),
            srtfd like zsopshist-srtfd,
            srtfdh like zsopshist-srtfd.
      srtfd0(5) = s_oprcd5(5).
      srtfd+5(8) = s_aedtm.
      srtfd+13(6) = '000000'.
       if s_oprcdh is initial.
         s_oprcdh = s_oprcd.
       endif.
      srtfdh0(5) = s_oprcdh5(5).
      srtfdh+5(8) = s_aedtmh.
      srtfdh+13(6) = '999999'.
      select srtfd from zsopshist into table itab
              WHERE  SRTFD >= SRTFD
              AND    SRTFD <= SRTFDH.
    sort itab by srtfd.
      loop at itab.
        IF ITAB+5(8) GE S_AEDTM  AND                            "IJHM00001
            ITAB+5(8) LE S_AEDTMH.                              "IJHM00001
          move: itab+0(5)          to i_key-kostl,
                itab+5(8)          to i_key-aedat,
                itab+13(6)         to i_key-cputm.
          clear: v_subrc, prev_format.
          if itab+5(8) lt new_date.
            prev_format = 'X'.
            perform import_record_prev changing v_subrc.      "PJCHG10854
          else.
            perform import_record changing v_subrc.           "PJCHG10854
          endif.
          if v_subrc = 0.                                     "PJCHG10854
            perform get_final_table.
          endif.
        ENDIF.                                                  "IJHM00001
      endloop.
      if p_regsrt = 'X'.
        sort table by oprcd field date descending.
        text = 'Cost Center'(C04).
      else.
        sort table by field oprcd date descending.
        text = 'Field Changed'(C01).
      endif.
       perform write_report.
          FORM get_final_table                                          *
    form get_final_table.
    move old_zsops to ihist.           "PJCHG10854
    move new_zsops to nhist.           "PJCHG10854
      if prev_format eq 'X'.              "PJCHG10854
        move old_prezsops to ihist.       "PJCHG10854
        move new_prezsops to nhist.       "PJCHG10854
      else.                               "PJCHG10854
        move old_zzsops to ihist.         "PJCHG10854
        move new_zzsops to nhist.         "PJCHG10854
      endif.                              "PJCHG10854
      if ihist-ivcrg ne nhist-ivcrg.
       table-text = 'Invst Charge Base'(F01).
       table-field = 'IVCRG'.
        table-v_old   = ihist-ivcrg.
        table-v_new   = nhist-ivcrg.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-mgtfp ne nhist-mgtfp.
        table-field = 'MGTFP'.
        table-text = 'Mgt Fee %'(F02).
        table-v_old(12)   = ihist-mgtfp.
        table-v_new(12)   = nhist-mgtfp.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-discd ne nhist-discd.
        table-field = 'DISCD'.
        table-text = 'Cash Disc. Passback'(F03).
        table-v_old   = ihist-discd.
        table-v_new   = nhist-discd.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-consc ne nhist-consc.
        table-field = 'CONSC'.
        table-text = 'Subsidy Calc'(F04).
        table-v_old   = ihist-consc.
        table-v_new   = nhist-consc.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-payfart ne nhist-payfart.
        table-field = 'PAYFART'.
        table-text = 'Payroll Fringe'(F05).
        table-v_old(12)   = ihist-payfart.
        table-v_new(12)   = nhist-payfart.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-frbpb ne nhist-frbpb.
        table-field = 'FRBPB'.
        table-text = 'Rebate Pass Back'(F06).
        table-v_old(12)   = ihist-frbpb.
        table-v_new(12)   = nhist-frbpb.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-exlca ne nhist-exlca.
        table-field = 'EXLCA'.
        table-text = 'Excl Source27'(F07).
        table-v_old   = ihist-exlca.
        table-v_new   = nhist-exlca.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-exlcb ne nhist-exlcb.
        table-field = 'EXLCB'.
        table-text = 'Excl Source11'(F08).
        table-v_old   = ihist-exlcb.
        table-v_new   = nhist-exlcb.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-trnrate ne nhist-trnrate.
        table-field = 'TRNRATE'.
        table-text = 'Payroll Training'(F09).
        table-v_old(12)   = ihist-trnrate.
        table-v_new(12)   = nhist-trnrate.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-mgffa ne nhist-mgffa.
        table-field = 'MGFFA'.
        table-text = 'Mgt Fee Amt'(F10).
        table-v_old(12)   = ihist-mgffa.
        table-v_new(12)   = nhist-mgffa.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-mgtfi ne nhist-mgtfi.
        table-field = 'MGTFI'.
        table-text = 'Mgt Fees Indicator'(F11).
        table-v_old   = ihist-mgtfi.
        table-v_new   = nhist-mgtfi.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-eqres ne nhist-eqres.
        table-field = 'EQRES'.
        table-text = 'Eqip Res Accrual'(F12).
      table-v_old = ihist-eqres.                             "JJMM20040331
      table-v_new = nhist-eqres.                             "JJMM20040331
        table-v_old(12) = ihist-eqres.                         "JJMM20040331
        table-v_new(12) = nhist-eqres.                         "JJMM20040331
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-ovrhd ne nhist-ovrhd.
        table-field = 'OVRHD'.
        table-text = 'OverHead Amt'(F13).
        table-v_old(12)   = ihist-ovrhd.
        table-v_new(12)   = nhist-ovrhd.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
        if ihist-xaccural ne nhist-xaccural.
        table-field = 'XACCUARAL'.
        table-text = 'Exclude Accrual'(F14).
        table-v_old(12)   = ihist-xaccural.
        table-v_new(12)   = nhist-xaccural.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-ovrrt ne nhist-ovrrt.
        table-field = 'OVRRT'.
        table-text = 'OverHead Rate'(F15).
        table-v_old(12)   = ihist-ovrrt.
        table-v_new(12)   = nhist-ovrrt.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
        if ihist-ztbd01 ne nhist-ztbd01.
        table-field = 'ZTBD01'.
      table-text = 'Char1'.                                  "JJMM20040330
        table-text = 'Meal Allowance'(F16).                    "JJMM20040330
        table-v_old   = ihist-ztbd01.
        table-v_new   = nhist-ztbd01.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    BEGIN OF BLOCK INSERTED FOR                            "JJMM20040330
      if ihist-earlybil ne nhist-earlybil.
        table-field = 'EARLYBIL'.
        table-text = 'Early Billing'(F17).
        table-v_old   = ihist-earlybil.
        table-v_new   = nhist-earlybil.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
      if ihist-combined ne nhist-combined.
        table-field = 'COMBINED'.
        table-text = 'Combined Billing'(F18).
        table-v_old   = ihist-COMBINED.
        table-v_new   = nhist-COMBINED.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    END OF BLOCK INSERTED FOR                                "JJMM20040330
        if ihist-rate1 ne nhist-rate1.
        table-field = 'RATE1'.
        table-text = 'Rate 1'(F19).
        table-v_old(12)   = ihist-rate1.
        table-v_new(12)  = nhist-rate1.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate2.                            "JJMM20040330
      table-field = 'RATE1'.                                 "JJMM20040330
    if ihist-rate2 ne nhist-rate2.                            "JJMM20040330
        table-field = 'RATE2'.                                 "JJMM20040330
        table-text = 'Rate 2'(F20).
        table-v_old(12)   = ihist-rate2.
        table-v_new(12)   = nhist-rate2.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate3.                            "JJMM20040330
    if ihist-rate3 ne nhist-rate3.                            "JJMM20040330
        table-field = 'RATE3'.
        table-text = 'Rate 3'(F21).
        table-v_old(12)   = ihist-rate3.
        table-v_new(12)   = nhist-rate3.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate4.                            "JJMM20040330
    if ihist-rate4 ne nhist-rate4.                            "JJMM20040330
        table-field = 'RATE4'.
        table-text = 'Rate 4'(F22).
        table-v_old(12)   = ihist-rate4.
        table-v_new(12)   = nhist-rate4.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate5.                            "JJMM20040330
    if ihist-rate5 ne nhist-rate5.                            "JJMM20040330
        table-field = 'RATE5'.
        table-text = 'Rate 5'(F23).
        table-v_old(12)   = ihist-rate5.
        table-v_new(12)   = nhist-rate5.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate6.                            "JJMM20040330
    if ihist-rate6 ne nhist-rate6.                            "JJMM20040330
        table-field = 'RATE6'.
        table-text = 'Rate 6'(F24).
        table-v_old(12)   = ihist-rate6.
        table-v_new(12)   = nhist-rate6.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate7.                            "JJMM20040330
    if ihist-rate7 ne nhist-rate7.                            "JJMM20040330
        table-field = 'RATE7'.
        table-text = 'Rate 7'(F25).
        table-v_old(12)   = ihist-rate7.
        table-v_new(12)   = nhist-rate7.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate8.                            "JJMM20040330
    if ihist-rate8 ne nhist-rate8.                            "JJMM20040330
        table-field = 'RATE8'.
        table-text = 'Rate 8'(F26).
        table-v_old(12)   = ihist-rate8.
        table-v_new(12)   = nhist-rate8.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate9.                            "JJMM20040330
    if ihist-rate9 ne nhist-rate9.                            "JJMM20040330
        table-field = 'RATE9'.
        table-text = 'Rate 9'(F27).
        table-v_old(12)   = ihist-rate9.
        table-v_new(12)   = nhist-rate9.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate10.                           "JJMM20040330
    if ihist-rate10 ne nhist-rate10.                          "JJMM20040330
        table-field = 'RATE10'.
        table-text = 'Rate 10'(F28).
        table-v_old(12)   = ihist-rate10.
        table-v_new(12)   = nhist-rate10.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate11.                           "JJMM20040330
    if ihist-rate11 ne nhist-rate11.                          "JJMM20040330
       table-field = 'RATE11'.
        table-text = 'Rate 11'(F29).
        table-v_old(12)   = ihist-rate11.
        table-v_new(12)   = nhist-rate11.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    The following lines of code have been added per change IJHM00001
    if ihist-rate12 ne nhist-rate12.
       table-field = 'RATE12'.
        table-text = 'Rate 12'(F30).
        table-v_old(12)   = ihist-rate12.
        table-v_new(12)   = nhist-rate12.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate13 ne nhist-rate13.
       table-field = 'RATE13'.
        table-text = 'Rate 13'(F31).
        table-v_old(12)   = ihist-rate13.
        table-v_new(12)   = nhist-rate13.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate14 ne nhist-rate14.
       table-field = 'RATE14'.
        table-text = 'Rate 14'(F32).
        table-v_old(12)   = ihist-rate14.
        table-v_new(12)   = nhist-rate14.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate15 ne nhist-rate15.
       table-field = 'RATE15'.
        table-text = 'Rate 15'(F33).
        table-v_old(12)   = ihist-rate15.
        table-v_new(12)   = nhist-rate15.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate16 ne nhist-rate16.
       table-field = 'RATE16'.
        table-text = 'Rate 16'(F34).
        table-v_old(12)   = ihist-rate16.
        table-v_new(12)   = nhist-rate16.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate17 ne nhist-rate17.
       table-field = 'RATE17'.
        table-text = 'Rate 17'(F35).
        table-v_old(12)   = ihist-rate17.
        table-v_new(12)   = nhist-rate17.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate18 ne nhist-rate18.
       table-field = 'RATE18'.
        table-text = 'Rate 18'(F36).
        table-v_old(12)   = ihist-rate18.
        table-v_new(12)   = nhist-rate18.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    The following lines of code have been added per change IJHM00002
    if ihist-rate19 ne nhist-rate19.
       table-field = 'RATE19'.
        table-text = 'Rate 19'(F37).
        table-v_old(12)   = ihist-rate19.
        table-v_new(12)   = nhist-rate19.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate20 ne nhist-rate20.
       table-field = 'RATE20'.
        table-text = 'Rate 20'(F38).
        table-v_old(12)   = ihist-rate20.
        table-v_new(12)   = nhist-rate20.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate21 ne nhist-rate21.
       table-field = 'RATE21'.
        table-text = 'Rate 21'(F39).
        table-v_old(12)   = ihist-rate21.
        table-v_new(12)   = nhist-rate21.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate22 ne nhist-rate22.
       table-field = 'RATE22'.
        table-text = 'Rate 22'(F40).
        table-v_old(12)   = ihist-rate22.
        table-v_new(12)   = nhist-rate22.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-intcrb ne nhist-intcrb.
       table-field = 'INTCRB'.
        table-text = 'Intcrb'(F47).                             "IJHM00002
       table-text = 'Intcrb'(F37).                            "IJHM00002
        table-v_old   = ihist-intcrb.
        table-v_new   = nhist-intcrb.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-intcrr ne nhist-intcrr.
       table-field = 'INTCRR'.
        table-text = 'Intcrr'(F48).                             "IJHM00002
       table-text = 'Intcrr'(F38).                            "IJHM00002
        table-v_old(12)   = ihist-intcrr.
        table-v_new(12)   = nhist-intcrr.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-zwktran ne nhist-zwktran.
       table-field = 'ZWKTRAN'.
        table-text = 'Data Trans End Unit'(F49).                "IJHM00002
       table-text = 'Data Trans End Unit'(F39).               "IJHM00002
        table-v_old   = ihist-zwktran.
        table-v_new   = nhist-zwktran.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-zwkbud ne nhist-zwkbud.
       table-field = 'ZWKBUD'.
        table-text = 'Wkly Budget Ind'(F50).                    "IJHM00002
       table-text = 'Wkly Budget Ind'(F40).                   "IJHM00002
        table-v_old   = ihist-zwkbud.
        table-v_new   = nhist-zwkbud.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-bcycle ne nhist-bcycle.
       table-field = 'BCYCLE'.
        table-text = 'Bcycle'(F51).                             "IJHM00002
       table-text = 'Bcycle'(F41).                            "IJHM00002
        table-v_old   = ihist-bcycle.
        table-v_new   = nhist-bcycle.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-ovind ne nhist-ovind.
       table-field = 'OVIND'.
        table-text = 'Ovind'(F52).                              "IJHM00002
       table-text = 'Ovind'(F42).                             "IJHM00002
        table-v_old   = ihist-ovind.
        table-v_new   = nhist-ovind.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    *New code for PRSID -
    "ZN032106
      if ihist-prsid ne nhist-prsid.
       table-field = 'PRSID'.
        table-text = 'PRSID'(F53).
        table-v_old   = ihist-prsid.
        table-v_new   = nhist-prsid.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    *End of new code----
    "ZN032106
    endform.
          FORM write_report                                             *
    form write_report.
    loop at table.
      write:/1 table-text,   25 table-v_old(12) left-justified,
             55 table-v_new(12) left-justified, 85 table-oprcd,
             106 table-user, 120 table-date.
      uline.
    endloop.
    skip 5.                                                    "JJMM20040330
    write:/35 TEXT-R01.                                        "JJMM20040330
    reserve 1 lines.                                           "JJMM20040330
    endform.
    *&      Form  import_record
    form import_record changing p_subrc.
         import i_key
               old_zsops to old_zzsops
               new_zsops to new_zzsops
               from database zsopshist(Z1)
               id i_key.
         p_subrc = sy-subrc.
    endform.                    " import_record
    *&      Form  import_record_prev
    form import_record_prev changing p_subrc.
         import i_key
               old_zsops to old_prezsops
               new_zsops to new_prezsops
               from database zsopshist(Z1)
               id i_key.
         p_subrc = sy-subrc.
    endform.                    " import_record_prev
    *&      Form  import_record_long
    form import_record_long changing p_subrc.
         import i_key
               old_zsops to old_lzsops
               new_zsops to new_lzsops
               from database zsopshist(Z1)
               id i_key.
         p_subrc = sy-subrc.
    endform.                    " import_record_prev
    ===
    <b>Here is the dump I am getting:</b>
    ====================
      Error when attempting to IMPORT object "OLD_ZSOPS".
    An exception occurred that is explained in detail below.                      
    The exception, which is assigned to class 'CX_SY_IMPORT_MISMATCH_ERROR', was  
      not caught in                                                                
    procedure "IMPORT_RECORD" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the         
    exception would occur, the current program is terminated.                     
    The reason for the exception is:                                              
    The object "OLD_ZSOPS" has a different object type in the dataset from        
    that in the target program "ZCFICO6010".                                      
       Try to find out why the type of the object is incorrect.                            
       There are various possible options:                                                                               
    1. The type of the imported object has changed in the Data Dictionary.              
          Make sure that the type of the imported object matches the type                  
          of the object in the Data Dictionary.                                            
          If the data cannot be restored from another source, the data must be             
          read by the 'old' structure, converted und again eported with the new            
          structure, so that future IMPORTs will always function with the new              
          structure.                                                                               
    2. A new program version is active, which no longer fits the dataset.               
          Try to solve the error generating the program "ZCFICO6010" again. This           
          works as follows: Select transaction SE38 in the SAP system. Enter               
          the program name "ZCFICO6010". Then activate the function 'Generate'.                                                                               
    If the error occures in a non-modified SAP program, you may be able to              
       find an interim solution in an SAP Note.                                            
       If you have access to SAP Notes, carry out a search with the following              
       keywords:                                                                               
    "CONNE_IMPORT_WRONG_OBJECT_TYPE" "CX_SY_IMPORT_MISMATCH_ERROR"                      
       "ZCFICO6010" or "ZCFICO6010"                                                        
       "IMPORT_RECORD"                                                                               
    If you cannot solve the problem yourself and want to send an error                  
       notification to SAP, include the following information:                                                                               
    1. The description of the current problem (short dump)                              
        To save the description, choose "System->List->Save->Local File           
    (Unconverted)".                                                                               
    2. Corresponding system log                                                                               
    Display the system log by calling transaction SM21.                       
        Restrict the time interval to 10 minutes before and five minutes          
    after the short dump. Then choose "System->List->Save->Local File            
    (Unconverted)".                                                                               
    3. If the problem occurs in a problem of your own or a modified SAP          
    program: The source code of the program                                      
        In the editor, choose "Utilities->More                                    
    Utilities->Upload/Download->Download".                                                                               
    4. Details about the conditions under which the error occurred or which      
    actions and input led to the error.                                                                               
    The exception must either be prevented, caught within proedure               
    "IMPORT_RECORD" "(FORM)", or its possible occurrence must be declared in the 
    RAISING clause of the procedure.                                             
    To prevent the exception, note the following:                                
    ==============
    Sorry forthis lengthy post but I was having difficulty explaining in previous post. All answers will be rewarded..
    Thanks.
    Mithun

    What is the structure for zsops ?
    There seems to be a compatibility issue....

  • Please help me with modifying this code

    I am using the attached code to acauire and save data to a text file, using 'write measurement file' express VI.
    WHat I want to do is to replace 'write to measurement VI' with low-level file I/O VIs. I tried to convert the express VI, but the obtained code is too complicated.
    Anyone can give me hints for using file I/O Vis to implement same function without using the express VI? Thanks a lot.
    Message Edited by Dejun on 08-27-2007 11:26 AM
    Attachments:
    4.png ‏14 KB
    code.vi ‏121 KB

    Above code is in a case of an event structure, i.e., each time I click a buttom, such as 'RUN', data acquisition begins and write data into a file.
    What I want is, each time this event case is executed, a file is open, write data to it, and finally close this file. The next time when I run this case, maybe another file is open for writting data.
    The problem of using 'write measure file' express VI is: if a file is open in one execution of the case, it will continuously be in 'open' after this case execution is finished, i.e., there is no explicit close file function with the express VI, which in some cases may be a problem. What I need is closing the file at the end of each execution of a event case. With low-level file I/O VIs, maybe I can directly put a close file VI there.
    The data file should be in text format so that data analysis software, such as MS-powerpoint, can directly reads it.
    Message Edited by Dejun on 08-27-2007 01:55 PM
    Message Edited by Dejun on 08-27-2007 01:56 PM

  • HELP me with the source code

    In this assignment you are asked to create a Java class that simulates the Java Vector class. You are also asked to create two Exception classes to allow the program to continue if errors occur. These are �MyVectNoDataException� and �MyVectIndexOutOfBoundsException�.
    1.     Write a Java class called �myVect� which will operate in the same way as the Java Vector class. In particular it should have
    a.     The following data members
    i.     An Object array
    ii.     An integer �size� that determines the size of the array
    iii.     An integer �increment� that defines the number of additional elements that will be added when the Array is to be resized.
    b.     The following methods
    i.     Constructor 1      myVect()that creates a new myVect object with an internal array size of 10 and an increment of 3.
    ii.     Constructor 2           myVect(int s)
    that creates a new myVect object with an internal array size of s and an increment of 3.
    iii.     Constructor 3           myVect(int s, int i)
    that creates a new myVect object with an internal array size of s and an increment of i.
    iv.     A method          void resize()
    that increases the size of the internal array by the number of elements in the �increment� variable.
    v.     A method      void addElement(Object o)
    that inserts an Object at the next available position in the internal array. If there are less than 3 vacant elements left in the array then the resize() method should be run automatically.
    vi.     A method      void deleteElement()
    that deletes the Object at the last occupied position in the internal array. If no element contains an Object then a MyVectNoDataException should be thrown and the program should continue.
    vii.     A method void insertElement(Object o,int p)
    that inserts an Object at position p in the internal array. The Objects at position p and below should each be moved down by one position before the insertion.
    If the index p is outside the bounds of the internal array then a MyVectIndexOutOfBoundsException should be thrown and the program should continue.
    viii.     A method void deleteElementAt(int p)
    that deletes the Object at position p in the internal array. The Objects below position p should each be moved up by one position after the deletion. If the index p is outside the bounds of the internal array then a MyVectIndexOutOfBoundsException should be thrown and the program should continue.
    If the position p is valid but does not contain an Object then a MyVectNoDataException should be thrown and the program should continue.
    ix.     A method      Object getElement()
    that returns the Object at the last occupied position in the internal array.
    x.     A method      Object getElementAt(int p)
    that returns the Object at position p in the internal array. If the index p is outside the bounds of the internal array then a MyVectIndexOutOfBoundsException should be thrown and the program should continue. If the position p is valid but does not contain an Object then a MyVectNoDataException should be thrown and the program should continue.
    xi.     A toString() method that produces a formatted String representing the myVect object and its data. It should also include the size and increment values.
    c.     Write a Java program called Assign3.java that creates a myVect object then
    i.     Store 6 objects of the following types
    1.     String
    2.     Date
    3.     Integer
    4.     String
    5.     StringTokenizer
    6.     Date
    ii.     Print the myVect object.
    iii.     Add 2 more objects
    1.     StringBuffer
    2.     Double
    iv.     Print the myVect object
    v.     Delete the Object at position 2
    vi.     Delete the Object at position 15
    vii.     Display the Object at position 10
    viii.     Display the length of the second String.
    ix.     Print the myVect object
    d.     Include Javadoc comments in the myVect class code then produce Java documentation using Javadoc.

    * @(#)MyOwnVectorReallyItIs.java     1.89 03/01/23
    * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
    * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
    package java.util;
    * The <code>MyOwnVectorReallyItIs</code> class implements a growable array of
    * objects. Like an array, it contains components that can be
    * accessed using an integer index. However, the size of a
    * <code>MyOwnVectorReallyItIs</code> can grow or shrink as needed to accommodate
    * adding and removing items after the <code>MyOwnVectorReallyItIs</code> has been created.<p>
    * Each MyOwnVectorReallyItIs tries to optimize storage management by maintaining a
    * <code>capacity</code> and a <code>capacityIncrement</code>. The
    * <code>capacity</code> is always at least as large as the MyOwnVectorReallyItIs
    * size; it is usually larger because as components are added to the
    * MyOwnVectorReallyItIs, the MyOwnVectorReallyItIs's storage increases in chunks the size of
    * <code>capacityIncrement</code>. An application can increase the
    * capacity of a MyOwnVectorReallyItIs before inserting a large number of
    * components; this reduces the amount of incremental reallocation. <p>
    * As of the Java 2 platform v1.2, this class has been retrofitted to
    * implement List, so that it becomes a part of Java's collection framework.
    * Unlike the new collection implementations, MyOwnVectorReallyItIs is synchronized.<p>
    * The Iterators returned by MyOwnVectorReallyItIs's iterator and listIterator
    * methods are <em>fail-fast</em>: if the MyOwnVectorReallyItIs is structurally modified
    * at any time after the Iterator is created, in any way except through the
    * Iterator's own remove or add methods, the Iterator will throw a
    * ConcurrentModificationException.  Thus, in the face of concurrent
    * modification, the Iterator fails quickly and cleanly, rather than risking
    * arbitrary, non-deterministic behavior at an undetermined time in the future.
    * The Enumerations returned by MyOwnVectorReallyItIs's elements method are <em>not</em>
    * fail-fast.
    * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
    * as it is, generally speaking, impossible to make any hard guarantees in the
    * presence of unsynchronized concurrent modification.  Fail-fast iterators
    * throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
    * Therefore, it would be wrong to write a program that depended on this
    * exception for its correctness:  <i>the fail-fast behavior of iterators
    * should be used only to detect bugs.</i><p>
    * This class is a member of the
    * <a href="{@docRoot}/../guide/collections/index.html">
    * Java Collections Framework</a>.
    * @author  Lee Boynton
    * @author  Jonathan Payne
    * @version 1.89, 01/23/03
    * @see Collection
    * @see List
    * @see ArrayList
    * @see LinkedList
    * @since   JDK1.0
    public class MyOwnVectorReallyItIs extends AbstractList
            implements List, RandomAccess, Cloneable, java.io.Serializable
         * The array buffer into which the components of the MyOwnVectorReallyItIs are
         * stored. The capacity of the MyOwnVectorReallyItIs is the length of this array buffer,
         * and is at least large enough to contain all the MyOwnVectorReallyItIs's elements.<p>
         * Any array elements following the last element in the MyOwnVectorReallyItIs are null.
         * @serial
        protected Object elementData[];
         * The number of valid components in this <tt>MyOwnVectorReallyItIs</tt> object.
         * Components <tt>elementData[0]</tt> through
         * <tt>elementData[elementCount-1]</tt> are the actual items.
         * @serial
        protected int elementCount;
         * The amount by which the capacity of the MyOwnVectorReallyItIs is automatically
         * incremented when its size becomes greater than its capacity.  If
         * the capacity increment is less than or equal to zero, the capacity
         * of the MyOwnVectorReallyItIs is doubled each time it needs to grow.
         * @serial
        protected int capacityIncrement;
        /** use serialVersionUID from JDK 1.0.2 for interoperability */
        private static final long serialVersionUID = -2767605614048989439L;
         * Constructs an empty MyOwnVectorReallyItIs with the specified initial capacity and
         * capacity increment.
         * @param   initialCapacity     the initial capacity of the MyOwnVectorReallyItIs.
         * @param   capacityIncrement   the amount by which the capacity is
         *                              increased when the MyOwnVectorReallyItIs overflows.
         * @exception IllegalArgumentException if the specified initial capacity
         *               is negative
        public MyOwnVectorReallyItIs(int initialCapacity, int capacityIncrement) {
         super();
            if (initialCapacity < 0)
                throw new IllegalArgumentException("Illegal Capacity: "+
                                                   initialCapacity);
         this.elementData = new Object[initialCapacity];
         this.capacityIncrement = capacityIncrement;
         * Constructs an empty MyOwnVectorReallyItIs with the specified initial capacity and
         * with its capacity increment equal to zero.
         * @param   initialCapacity   the initial capacity of the MyOwnVectorReallyItIs.
         * @exception IllegalArgumentException if the specified initial capacity
         *               is negative
        public MyOwnVectorReallyItIs(int initialCapacity) {
         this(initialCapacity, 0);
         * Constructs an empty MyOwnVectorReallyItIs so that its internal data array
         * has size <tt>10</tt> and its standard capacity increment is
         * zero.
        public MyOwnVectorReallyItIs() {
         this(10);
         * Constructs a MyOwnVectorReallyItIs containing the elements of the specified
         * collection, in the order they are returned by the collection's
         * iterator.
         * @param c the collection whose elements are to be placed into this
         *       MyOwnVectorReallyItIs.
         * @throws NullPointerException if the specified collection is null.
         * @since   1.2
        public MyOwnVectorReallyItIs(Collection c) {
            elementCount = c.size();
            // 10% for growth
            elementData = new Object[
                          (int)Math.min((elementCount*110L)/100,Integer.MAX_VALUE)];
            c.toArray(elementData);
         * Copies the components of this MyOwnVectorReallyItIs into the specified array. The
         * item at index <tt>k</tt> in this MyOwnVectorReallyItIs is copied into component
         * <tt>k</tt> of <tt>anArray</tt>. The array must be big enough to hold
         * all the objects in this MyOwnVectorReallyItIs, else an
         * <tt>IndexOutOfBoundsException</tt> is thrown.
         * @param   anArray   the array into which the components get copied.
         * @throws  NullPointerException if the given array is null.
        public synchronized void copyInto(Object anArray[]) {
         System.arraycopy(elementData, 0, anArray, 0, elementCount);
         * Trims the capacity of this MyOwnVectorReallyItIs to be the MyOwnVectorReallyItIs's current
         * size. If the capacity of this MyOwnVectorReallyItIs is larger than its current
         * size, then the capacity is changed to equal the size by replacing
         * its internal data array, kept in the field <tt>elementData</tt>,
         * with a smaller one. An application can use this operation to
         * minimize the storage of a MyOwnVectorReallyItIs.
        public synchronized void trimToSize() {
         modCount++;
         int oldCapacity = elementData.length;
         if (elementCount < oldCapacity) {
             Object oldData[] = elementData;
             elementData = new Object[elementCount];
             System.arraycopy(oldData, 0, elementData, 0, elementCount);
         * Increases the capacity of this MyOwnVectorReallyItIs, if necessary, to ensure
         * that it can hold at least the number of components specified by
         * the minimum capacity argument.
         * <p>If the current capacity of this MyOwnVectorReallyItIs is less than
         * <tt>minCapacity</tt>, then its capacity is increased by replacing its
         * internal data array, kept in the field <tt>elementData</tt>, with a
         * larger one.  The size of the new data array will be the old size plus
         * <tt>capacityIncrement</tt>, unless the value of
         * <tt>capacityIncrement</tt> is less than or equal to zero, in which case
         * the new capacity will be twice the old capacity; but if this new size
         * is still smaller than <tt>minCapacity</tt>, then the new capacity will
         * be <tt>minCapacity</tt>.
         * @param minCapacity the desired minimum capacity.
        public synchronized void ensureCapacity(int minCapacity) {
         modCount++;
         ensureCapacityHelper(minCapacity);
         * This implements the unsynchronized semantics of ensureCapacity.
         * Synchronized methods in this class can internally call this
         * method for ensuring capacity without incurring the cost of an
         * extra synchronization.
         * @see java.util.MyOwnVectorReallyItIs#ensureCapacity(int)
        private void ensureCapacityHelper(int minCapacity) {
         int oldCapacity = elementData.length;
         if (minCapacity > oldCapacity) {
             Object oldData[] = elementData;
             int newCapacity = (capacityIncrement > 0) ?
              (oldCapacity + capacityIncrement) : (oldCapacity * 2);
                 if (newCapacity < minCapacity) {
              newCapacity = minCapacity;
             elementData = new Object[newCapacity];
             System.arraycopy(oldData, 0, elementData, 0, elementCount);
         * Sets the size of this MyOwnVectorReallyItIs. If the new size is greater than the
         * current size, new <code>null</code> items are added to the end of
         * the MyOwnVectorReallyItIs. If the new size is less than the current size, all
         * components at index <code>newSize</code> and greater are discarded.
         * @param   newSize   the new size of this MyOwnVectorReallyItIs.
         * @throws  ArrayIndexOutOfBoundsException if new size is negative.
        public synchronized void setSize(int newSize) {
         modCount++;
         if (newSize > elementCount) {
             ensureCapacityHelper(newSize);
         } else {
             for (int i = newSize ; i < elementCount ; i++) {
              elementData[i] = null;
         elementCount = newSize;
         * Returns the current capacity of this MyOwnVectorReallyItIs.
         * @return  the current capacity (the length of its internal
         *          data array, kept in the field <tt>elementData</tt>
         *          of this MyOwnVectorReallyItIs).
        public synchronized int capacity() {
         return elementData.length;
         * Returns the number of components in this MyOwnVectorReallyItIs.
         * @return  the number of components in this MyOwnVectorReallyItIs.
        public synchronized int size() {
         return elementCount;
         * Tests if this MyOwnVectorReallyItIs has no components.
         * @return  <code>true</code> if and only if this MyOwnVectorReallyItIs has
         *          no components, that is, its size is zero;
         *          <code>false</code> otherwise.
        public synchronized boolean isEmpty() {
         return elementCount == 0;
         * Returns an enumeration of the components of this MyOwnVectorReallyItIs. The
         * returned <tt>Enumeration</tt> object will generate all items in
         * this MyOwnVectorReallyItIs. The first item generated is the item at index <tt>0</tt>,
         * then the item at index <tt>1</tt>, and so on.
         * @return  an enumeration of the components of this MyOwnVectorReallyItIs.
         * @see     Enumeration
         * @see     Iterator
        public Enumeration elements() {
         return new Enumeration() {
             int count = 0;
             public boolean hasMoreElements() {
              return count < elementCount;
             public Object nextElement() {
              synchronized (MyOwnVectorReallyItIs.this) {
                  if (count < elementCount) {
                   return elementData[count++];
              throw new NoSuchElementException("MyOwnVectorReallyItIs Enumeration");
         * Tests if the specified object is a component in this MyOwnVectorReallyItIs.
         * @param   elem   an object.
         * @return  <code>true</code> if and only if the specified object
         * is the same as a component in this MyOwnVectorReallyItIs, as determined by the
         * <tt>equals</tt> method; <code>false</code> otherwise.
        public boolean contains(Object elem) {
         return indexOf(elem, 0) >= 0;
         * Searches for the first occurence of the given argument, testing
         * for equality using the <code>equals</code> method.
         * @param   elem   an object.
         * @return  the index of the first occurrence of the argument in this
         *          MyOwnVectorReallyItIs, that is, the smallest value <tt>k</tt> such that
         *          <tt>elem.equals(elementData[k])</tt> is <tt>true</tt>;
         *          returns <code>-1</code> if the object is not found.
         * @see     Object#equals(Object)
        public int indexOf(Object elem) {
         return indexOf(elem, 0);
         * Searches for the first occurence of the given argument, beginning
         * the search at <code>index</code>, and testing for equality using
         * the <code>equals</code> method.
         * @param   elem    an object.
         * @param   index   the non-negative index to start searching from.
         * @return  the index of the first occurrence of the object argument in
         *          this MyOwnVectorReallyItIs at position <code>index</code> or later in the
         *          MyOwnVectorReallyItIs, that is, the smallest value <tt>k</tt> such that
         *          <tt>elem.equals(elementData[k]) && (k >= index)</tt> is
         *          <tt>true</tt>; returns <code>-1</code> if the object is not
         *          found. (Returns <code>-1</code> if <tt>index</tt> >= the
         *          current size of this <tt>MyOwnVectorReallyItIs</tt>.)
         * @exception  IndexOutOfBoundsException  if <tt>index</tt> is negative.
         * @see     Object#equals(Object)
        public synchronized int indexOf(Object elem, int index) {
         if (elem == null) {
             for (int i = index ; i < elementCount ; i++)
              if (elementData==null)
              return i;
         } else {
         for (int i = index ; i < elementCount ; i++)
              if (elem.equals(elementData[i]))
              return i;
         return -1;
    * Returns the index of the last occurrence of the specified object in
    * this MyOwnVectorReallyItIs.
    * @param elem the desired component.
    * @return the index of the last occurrence of the specified object in
    * this MyOwnVectorReallyItIs, that is, the largest value <tt>k</tt> such that
    * <tt>elem.equals(elementData[k])</tt> is <tt>true</tt>;
    * returns <code>-1</code> if the object is not found.
    public synchronized int lastIndexOf(Object elem) {
         return lastIndexOf(elem, elementCount-1);
    * Searches backwards for the specified object, starting from the
    * specified index, and returns an index to it.
    * @param elem the desired component.
    * @param index the index to start searching from.
    * @return the index of the last occurrence of the specified object in this
    * MyOwnVectorReallyItIs at position less than or equal to <code>index</code> in
    * the MyOwnVectorReallyItIs, that is, the largest value <tt>k</tt> such that
    * <tt>elem.equals(elementData[k]) && (k <= index)</tt> is
    * <tt>true</tt>; <code>-1</code> if the object is not found.
    * (Returns <code>-1</code> if <tt>index</tt> is negative.)
    * @exception IndexOutOfBoundsException if <tt>index</tt> is greater
    * than or equal to the current size of this MyOwnVectorReallyItIs.
    public synchronized int lastIndexOf(Object elem, int index) {
    if (index >= elementCount)
    throw new IndexOutOfBoundsException(index + " >= "+ elementCount);
         if (elem == null) {
         for (int i = index; i >= 0; i--)
              if (elementData[i]==null)
              return i;
         } else {
         for (int i = index; i >= 0; i--)
              if (elem.equals(elementData[i]))
              return i;
         return -1;
    * Returns the component at the specified index.<p>
    * This method is identical in functionality to the get method
    * (which is part of the List interface).
    * @param index an index into this MyOwnVectorReallyItIs.
    * @return the component at the specified index.
    * @exception ArrayIndexOutOfBoundsException if the <tt>index</tt>
    * is negative or not less than the current size of this
    * <tt>MyOwnVectorReallyItIs</tt> object.
    * given.
    * @see     #get(int)
    * @see     List
    public synchronized Object elementAt(int index) {
         if (index >= elementCount) {
         throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
    return elementData[index];
    * Returns the first component (the item at index <tt>0</tt>) of
    * this MyOwnVectorReallyItIs.
    * @return the first component of this MyOwnVectorReallyItIs.
    * @exception NoSuchElementException if this MyOwnVectorReallyItIs has no components.
    public synchronized Object firstElement() {
         if (elementCount == 0) {
         throw new NoSuchElementException();
         return elementData[0];
    * Returns the last component of the MyOwnVectorReallyItIs.
    * @return the last component of the MyOwnVectorReallyItIs, i.e., the component at index
    * <code>size() - 1</code>.
    * @exception NoSuchElementException if this MyOwnVectorReallyItIs is empty.
    public synchronized Object lastElement() {
         if (elementCount == 0) {
         throw new NoSuchElementException();
         return elementData[elementCount - 1];
    * Sets the component at the specified <code>index</code> of this
    * MyOwnVectorReallyItIs to be the specified object. The previous component at that
    * position is discarded.<p>
    * The index must be a value greater than or equal to <code>0</code>
    * and less than the current size of the MyOwnVectorReallyItIs. <p>
    * This method is identical in functionality to the set method
    * (which is part of the List interface). Note that the set method reverses
    * the order of the parameters, to more closely match array usage. Note
    * also that the set method returns the old value that was stored at the
    * specified position.
    * @param obj what the component is to be set to.
    * @param index the specified index.
    * @exception ArrayIndexOutOfBoundsException if the index was invalid.
    * @see #size()
    * @see List
    * @see     #set(int, java.lang.Object)
    public synchronized void setElementAt(Object obj, int index) {
         if (index >= elementCount) {
         throw new ArrayIndexOutOfBoundsException(index + " >= " +
                                  elementCount);
         elementData[index] = obj;
    * Deletes the component at the specified index. Each component in
    * this MyOwnVectorReallyItIs with an index greater or equal to the specified
    * <code>index</code> is shifted downward to have an index one
    * smaller than the value it had previously. The size of this MyOwnVectorReallyItIs
    * is decreased by <tt>1</tt>.<p>
    * The index must be a value greater than or equal to <code>0</code>
    * and less than the current size of the MyOwnVectorReallyItIs. <p>
    * This method is identical in functionality to the remove method
    * (which is part of the List interface). Note that the remove method
    * returns the old value that was stored at the specified position.
    * @param index the index of the object to remove.
    * @exception ArrayIndexOutOfBoundsException if the index was invalid.
    * @see #size()
    * @see     #remove(int)
    * @see     List
    public synchronized void removeElementAt(int index) {
         modCount++;
         if (index >= elementCount) {
         throw new ArrayIndexOutOfBoundsException(index + " >= " +
                                  elementCount);
         else if (index < 0) {
         throw new ArrayIndexOutOfBoundsException(index);
         int j = elementCount - index - 1;
         if (j > 0) {
         System.arraycopy(elementData, index + 1, elementData, index, j);
         elementCount--;
         elementData[elementCount] = null; /* to let gc do its work */
    * Inserts the specified object as a component in this MyOwnVectorReallyItIs at the
    * specified <code>index</code>. Each component in this MyOwnVectorReallyItIs with
    * an index greater or equal to the specified <code>index</code> is
    * shifted upward to have an index one greater than the value it had
    * previously. <p>
    * The index must be a value greater than or equal to <code>0</code>
    * and less than or equal to the current size of the MyOwnVectorReallyItIs. (If the
    * index is equal to the current size of the MyOwnVectorReallyItIs, the new element
    * is appended to the MyOwnVectorReallyItIs.)<p>
    * This method is identical in functionality to the add(Object, int) method
    * (which is part of the List interface). Note that the add method reverses
    * the order of the parameters, to more closely match array usage.
    * @param obj the component to insert.
    * @param index where to insert the new component.
    * @exception ArrayIndexOutOfBoundsException if the index was invalid.
    * @see #size()
    * @see     #add(int, Object)
    * @see     List
    public synchronized void insertElementAt(Object obj, int index) {
         modCount++;
         if (index > elementCount) {
         throw new ArrayIndexOutOfBoundsException(index
                                  + " > " + elementCount);
         ensureCapacityHelper(elementCount + 1);
         System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
         elementData[index] = obj;
         elementCount++;
    * Adds the specified component to the end of this MyOwnVectorReallyItIs,
    * increasing its size by one. The capacity of this MyOwnVectorReallyItIs is
    * increased if its size becomes greater than its capacity. <p>
    * This method is identical in functionality to the add(Object) method
    * (which is part of the List interface).
    * @param obj the component to be added.
    * @see     #add(Object)
    * @see     List
    public synchronized void addElement(Object obj) {
         modCount++;
         ensureCapacityHelper(elementCount + 1);
         elementData[elementCount++] = obj;
    * Removes the first (lowest-indexed) occurrence of the argument
    * from this MyOwnVectorReallyItIs. If the object is found in this MyOwnVectorReallyItIs, each
    * component in the MyOwnVectorReallyItIs with an index greater or equal to the
    * object's index is shifted downward to have an index one smaller
    * than the value it had previously.<p>
    * This method is identical in functionality to the remove(Object)
    * method (which is part of the List interface).
    * @param obj the component to be removed.
    * @return <code>true</code> if the argument was a component of this
    * MyOwnVectorReallyItIs; <code>false</code> otherwise.
    * @see     List#remove(Object)
    * @see     List
    public synchronized boolean removeElement(Object obj) {
         modCount++;
         int i = indexOf(obj);
         if (i >= 0) {
         removeElementAt(i);
         return true;
         return false;
    * Removes all components from this MyOwnVectorReallyItIs and sets its size to zero.<p>
    * This method is identical in functionality to the clear method
    * (which is part of the List interface).
    * @see     #clear
    * @see     List
    public synchronized void removeAllElements() {
    modCount++;
         // Let gc do its work
         for (int i = 0; i < elementCount; i++)
         elementData[i] = null;
         elementCount = 0;
    * Returns a clone of this MyOwnVectorReallyItIs. The copy will contain a
    * reference to a clone of the internal data array, not a reference
    * to the original internal data array of this <tt>MyOwnVectorReallyItIs</tt> object.
    * @return a clone of this MyOwnVectorReallyItIs.
    public synchronized Object clone() {
         try {
         MyOwnVectorReallyItIs v = (MyOwnVectorReallyItIs)super.clone();
         v.elementData = new Object[elementCount];
         System.arraycopy(elementData, 0, v.elementData, 0, elementCount);
         v.modCount = 0;
         return v;
         } catch (CloneNotSupportedException e) {
         // this shouldn't happen, since we are Cloneable
         throw new InternalError();
    * Returns an array containing all of the elements in this MyOwnVectorReallyItIs
    * in the correct order.
    * @since 1.2
    public synchronized Object[] toArray() {
         Object[] result = new Object[elementCount];
         System.arraycopy(elementData, 0, result, 0, elementCount);
         return result;
    * Returns an array containing all of the elements in this MyOwnVectorReallyItIs in the
    * correct order; the runtime type of the returned array is that of the
    * specified array. If the MyOwnVectorReallyItIs fits in the specified array, it is
    * returned therein. Otherwise, a new array is allocated with the runtime
    * type of the specified array and the size of this MyOwnVectorReallyItIs.<p>
    * If the MyOwnVectorReallyItIs fits in the specified array with room to spare
    * (i.e., the array has more elements than the MyOwnVectorReallyItIs),
    * the element in the array immediately following the end of the
    * MyOwnVectorReallyItIs is set to null. This is useful in determining the length
    * of the MyOwnVectorReallyItIs <em>only</em> if the caller knows that the MyOwnVectorReallyItIs
    * does not contain any null elements.
    * @param a the array into which the elements of the MyOwnVectorReallyItIs are to
    *          be stored, if it is big enough; otherwise, a new array of the
    *           same runtime type is allocated for this purpose.
    * @return an array containing the elements of the MyOwnVectorReallyItIs.
    * @exception ArrayStoreException the runtime type of a is not a supertype
    * of the runtime type of every element in this MyOwnVectorReallyItIs.
    * @throws NullPointerException if the given array is null.
    * @since 1.2
    public synchronized Object[] toArray(Object a[]) {
    if (a.length < elementCount)
    a = (Object[])java.lang.reflect.Array.newInstance(
    a.getClass().getComponentType(), elementCount);
         System.arraycopy(elementData, 0, a, 0, elementCount);
    if (a.length > elementCount)
    a[elementCount] = null;
    return a;
    // Positional Access Operations
    * Returns the element at the specified position in this MyOwnVectorReallyItIs.
    * @param index index of element to return.
    * @return object at the specified index
    * @exception ArrayIndexOutOfBoundsException index is out of range (index
    *           < 0 || index >= size()).
    * @since 1.2
    public synchronized Object get(int index) {
         if (index >= elementCount)
         throw new ArrayIndexOutOfBoundsException(index);
         return elementData[index];
    * Replaces the element at the specified position in this MyOwnVectorReallyItIs with the
    * specified element.
    * @param index index of element to replace.
    * @param element element to be stored at the specified position.
    * @return the element previously at the specified position.
    * @exception ArrayIndexOutOfBoundsException index out of range
    *          (index < 0 || index >= size()).
    * @since 1.2
    public synchronized Object set(int index, Object element) {
         if (index >= elementCount)
         throw new ArrayIndexOutOfBoundsException(index);
         Object oldValue = elementData[index];
         elementData[index] = element;
         return oldValue;
    * Appends the specified element to the end of this MyOwnVectorReallyItIs.
    * @param o element to be appended to this MyOwnVectorReallyItIs.
    * @return true (as per the general contract of Collection.add).
    * @since 1.2
    public synchronized boolean add(Object o) {
         modCount++;
         ensureCapacityHelper(elementCount + 1);
         elementData[elementCount++] = o;
    return true;
    * Removes the first occurrence of the specified element in this MyOwnVectorReallyItIs
    * If the MyOwnVectorReallyItIs does not contain the element, it is unchanged. More
    * formally, removes the element with the lowest index i such that
    * <code>(o==null ? get(i)==null : o.equals(get(i)))</code> (if such
    * an element exists).
    * @param o element to be removed from this MyOwnVectorReallyItIs, if present.
    * @return true if the MyOwnVectorReallyItIs contained the specified element.
    * @since 1.2
    public boolean remove(Object o) {
    return removeElement(o);
    * Inserts the specified element at the specified position in this MyOwnVectorReallyItIs.
    * Shifts the element currently at that position (if any) and any
    * subsequent elements to the right (adds one to their indices).
    * @param index index at which the specified element is to be inserted.
    * @param

  • Help me with my java code

    i have an assignment from the book java programming d.s malik.
    problem:
    for research purposes and to assist students, the admissions office of your local university wants to determine the performance of the female and male students in certain courses. You receive a file that contains female and male students' GPAs for certain courses. Due to confidentiality, the letter code f is used for female and m is used for male. every file entry consists of a letter code followed by a GPA. each line has one entry. the number of entries in the file is unknown. write a program that computes and outputs the average gpa for both female and male students. format your result to two decimal places.
    solution:
    this is what i have come up with:
    import java.io.*;
    import java.util.*;
    class Assignment6
         public static void main(String[] args)
                                  throws FileNotFoundException
               String str,
                         gender;
               double counter = 0;
               double counter2 = 0;
               double gpa = 0;
               double sum1, sum2;
               double average1, average2;
               Scanner console = new Scanner(System.in);
               Scanner inFile = new Scanner(new FileReader("gpa.txt"));
               PrintWriter outFile = new PrintWriter("gpa.out");
               gender = inFile.next();
               gpa = inFile.nextDouble();
               while(gender.charAt(0) != 'x')
                    if(gender == 'm')
                        sum1+= gpa;
                       counter = counter + 1.0;
                       average1 = sum1/counter;
                   else if(gender == 'f')
                        sum2+= gpa;
                        counter2 = counter2 + 1.0;
                        average2 = sum2/counter2;
               System.out.println("The count is " + counter);
               System.out.println("The average is = " + average1);
               System.out.println("The count is " + counter2);
               System.out.println("The average is = " + average2);
              outFile.print("There are " + counter + " male students.");
             outFile.printf("Average GPA for male students is: " + average1);
             outFile.print("There are " + counter2 + " female students.");
             outFile.printf("Average GPA for female students is: " + average2);
             outFile.close();
    }and the text file is
    gpa.txt
    m 2.4
    f 3.2
    m 3.7
    m 4.0
    f 2.9
    f 1.8
    f 3.8
    m 1.7
    m 3.4
    f 2.6
    m 2.8
    m 1.7
    f 3.7
    m 3.9
    f 4.0
    f 3.6
    m 2.3
    f 2.9
    m 3.0
    m 2.7
    x
    question:
    i couldn't compile and run it, i get 2 errors:
    M:\School\CSCI - 111 - Classwork\Assignments\Java1\Assignment6.java:29: incomparable types: java.lang.String and char
                   if(gender == 'm')
                   ^
    M:\School\CSCI - 111 - Classwork\Assignments\Java1\Assignment6.java:35: incomparable types: java.lang.String and char
                   else if(gender == 'f')
    thanks

    okay i did everything, but i still couldn't get it to work. i wonder if im using a wrong solution. or is there anything i didn't know before even proceeding into this?
    update:
    import java.io.*;
    import java.util.*;
    class Assignment6
         public static void main(String[] args)
                                  throws FileNotFoundException
               String str,
                        gender;
               double cntMale = 0;
               double cntFemale = 0;
               double gpa = 0;
               double sumMale = 0, sumFemale = 0;
               double avgMale = 0, avgFemale = 0;
               Scanner console = new Scanner(System.in);
               Scanner inFile = new Scanner(new FileReader("gpa.txt"));
               PrintWriter outFile = new PrintWriter("gpa.out");
               gender = inFile.next();
               gpa = inFile.nextDouble();
               while(gender.charAt(0) != 'x')
                    if(gender.charAt(0) == 'm')
                        sumMale+= gpa;
                       cntMale = cntMale + 1.0;
                   else if(gender.charAt(0) == 'f')
                        sumFemale+= gpa;
                        cntFemale = cntFemale + 1.0;
              avgMale = sumMale/cntMale;
              avgFemale = sumFemale/cntFemale;
               System.out.println("The count is " + cntMale);
               System.out.println("The average is = " + avgMale);
               System.out.println("The count is " + cntFemale);
               System.out.println("The average is = " + avgFemale);
              outFile.print("There are " + cntMale + " male students.");
             outFile.printf("Average GPA for male students is: " + avgMale);
             outFile.print("There are " + cntFemale + " female students.");
             outFile.printf("Average GPA for female students is: " + avgFemale);
              inFile.close();
             outFile.close();
    }Edited by: spkenn5 on Nov 9, 2008 4:31 PM

  • Desperate help needed with insertion sort code

    Here is my insertion sort code for a doubly linked list that does not work. I cannot figure out why and I've been trying everything for the last 10 hours! Please Please help..
    public void insertionSort()
        Node pointer=head;
        while(pointer.next!=null)
            Node insert=pointer.next;
            if (insert.item.compareTo(pointer.item)>0)
                pointer=pointer.next;
            else
                insert.prev.next=insert.next;
                insert.next.prev=insert.prev;
                if (head.item.compareTo(insert.item)>0)
                    insert.next=head;
                    insert.prev=null;
                    head.prev=insert;
                    head=insert;
                Node current =head.next;
                while (current.item.compareTo(insert.item)<0)
                    current=current.next;
                insert.next=current;
                insert.prev=current.prev;
                current.prev.next=insert;
                current.prev=insert;
    }

    It makes sense tracing it out on paper, running it,
    the program never ends.This means that there is an infinite loop somewhere in your code. Find the loops and put some System.out.println()'s in them to see where it's going wrong.

  • Help needed with iPad pass code

    Just bought a new iPad and backed up from my old one.
    Now being asked for a pass code but its not accepting the code from my previous iPad
    Can anyone help?

    If you can't remember the pass code you will have to wipe and restore as new.
    http://support.apple.com/kb/ht1212

  • I need help plz with this easy code

    The output shows null in the frame ,, no buttons no areas or fields .. plz help ASAP
    import java.awt.* ;
    import javax.swing.* ;
    public class GUI extends JFrame{
        public void function (){
             setSize(500,500);
             setTitle("SokAndO");
             Container first = this.getContentPane();
             JButton _send = new JButton ("Send") ;
             JTextField _text = new JTextField () ;
             JTextArea _history = new JTextArea (100,100);
             JPanel p1 = new JPanel();
             JPanel p2 = new JPanel();
             JPanel p3 = new JPanel();
             p1.add(_send);
             p2.add(_history);
             p3.add(_text);
                first.setLayout (new FlowLayout());
             setVisible(true);
             public static void main(String arg[]){
              GUI lol=new GUI();
              lol.function();
    }

    and wht is the use of this statment ???
    Container first =
    this.getContentPane();With this statement you have a variable first that refers to the JFrame's contentPane, but as noted above, you do nothing with it. You need to look at Swing examples on how to add components to JPanels and such. The Sun tutorials should be a good place to start.

  • I am in horry please if some one can help me with my FTP code, thanks

    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Ass_2 {
         public static void main(String[] args){
              String currentPath = new String(); currentPath = "ftp://ftp.scit.wlv.ac.uk/pub";
              try {
                   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                   String str,user,pass ;
                   System.out.println("\n\nTYPE HELP for view the list of commands and there Formats!!");
                   System.out.println("enter command 'bye' to exit the application");
                        System.out.print("Enter Username: ");
                        user = in.readLine();     
                        System.out.print("Enter Password: ");
                        pass = in.readLine();
                        String tempPath = new String();
                        String toFile = new String();
                        tempPath = currentPath ;
                        readPage(currentPath);
                   while (!(str = in.readLine()).equals("bye")){     
                        int     tokencount;
                        StringTokenizer     token = new StringTokenizer(str);
                        tokencount = token.countTokens();
                        String block[] = new String[tokencount];
                        for (int i = 0; i < tokencount; i++)
                             block[i] = token.nextToken();
                             System.out.println(block);
                        if (block[0].equalsIgnoreCase("dir")){
                             System.out.println("DIR");
                             System.out.println(currentPath);
                             readPage(currentPath);
                             System.out.println("\n");
                        }else if(block[0].equalsIgnoreCase("cwd")){
                             System.out.println("Change Directory");
                             currentPath = changeDirectory(currentPath, block[1]);
                             System.out.println("\n");
                        }else if(block[0].equalsIgnoreCase("get")){
                             System.out.println("Wait Copying File : "+block[1]);
                             copyFile(currentPath,block[1]);
                        }else if(block[0].equalsIgnoreCase("cd..")){
                             currentPath = goBack(currentPath);               
                        }else if(block[0].equalsIgnoreCase("help")){
                             System.out.println("\nYour in the Help Section \n");
                        }else {
                             System.out.println("Wrong Command or Format, Type Help!!!");
                             System.out.println("\n");
              catch(Exception e){
                   System.out.println(e);
         // Function to read content form the specfied path
         static void readPage(String path){
              String tempPath = new String();
              try {     
                   URL     pageref = new URL(path);
                   InputStream in = pageref.openStream();
                   BufferedReader inline = new BufferedReader(new InputStreamReader(in));//(instr);
                   String     line;
                   int     linect = 0;
                   while((line = inline.readLine())!=null){
                        linect++;
                        System.out.println(line);
                   System.out.println("lines read = "+linect);
              catch(Exception e){
                   System.out.println(e);
         static String changeDirectory(String path,String dir){
              path = path+"/"+dir;//System.out.println(">>>>>>>>>>> " path" >>> \n");
              readPage(path);     
              return path;
         // Function to go one setp back from the current directory
         static String goBack(String currentPath){
              return currentPath;
         /// Function for basic copy TXT file
         static void copyFile(String path,String file){
              try {
                   path = path +"/"+ file;     //System.out.println("Copy Path : " + path);
                   String fileName = new String();
                        fileName = file+".txt";
                        System.out.println("Out put file name : " + fileName);
                   OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(fileName));
                   URL     pageref = new URL(path);
                   InputStream in = pageref.openStream();
                   BufferedReader inline = new BufferedReader(new InputStreamReader(in));//(instr);
                   String     line;
                   int     linect = 0;
                   while((line = inline.readLine())!=null){
                        System.out.println(line);
                        linect++; //System.out.println(line);
                        out.write(line+"\r\n");
                   out.close();               
                   System.out.println("File - " file " - copyed Successfully !!");
              catch(Exception e){
                   System.out.println(e);

    h2. {color:#ff0000}Double post{color}
    Replies here:
    http://forum.java.sun.com/thread.jspa?threadID=5253627
    It's rude to double post.
    It's futile (at best) to advertise your time pressure.
    It's pointless to use a forum like this but not actually ask a question.

  • Somebody help me with this gridbaglayout code....

    guys
    do take a look at this problem....this code on being compile and executed doesn't give any error nor does it give any exception...no response at all.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.util.*;
    public class Applicant extends JFrame
         JPanel panel;
         JLabel lapid;
         JLabel lapaddress;
         JLabel lapposition;
         JLabel lapname;
         JButton submit;
         JButton reset;
         JTextField tapid;
         JTextField tapaddress;
         JTextField tapname;
         JComboBox cbapposition;
         GridBagLayout g;
         GridBagConstraints gbc;
         public Applicant()
              super("application");
              create();
         public void create()
              Container c=getContentPane();
              g=new GridBagLayout();
              gbc=new GridBagConstraints();
              panel=new JPanel();//(JPanel)getContentPane();
              panel.setLayout(g);
              lapid=new JLabel("applicant id");
              gbc.fill=GridBagConstraints.BOTH;
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=0;
              gbc.gridy=1;
              g.setConstraints(lapid,gbc);
              panel.add(lapid);
              tapid=new JTextField();
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=1;
              gbc.gridy=1;
              g.setConstraints(tapid,gbc);
              panel.add(tapid);
              lapname=new JLabel("applicant name");
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=0;
              gbc.gridy=2;
              g.setConstraints(lapname,gbc);
              panel.add(lapname);
              tapname=new JTextField();
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=1;
              gbc.gridy=2;
              g.setConstraints(tapname,gbc);
              panel.add(tapname);
              lapaddress=new JLabel ("applicant address");
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=0;
              gbc.gridy=3;
              g.setConstraints(lapaddress,gbc);     
              panel.add(lapaddress);
              tapaddress= new JTextField();
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=1;
              gbc.gridy=3;
              g.setConstraints(tapaddress,gbc);
              panel.add(tapaddress);
              lapposition=new JLabel("applicant position");
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=0;
              gbc.gridy=4;
              g.setConstraints(lapposition,gbc);
              panel.add(lapposition);
              cbapposition=new JComboBox();
              cbapposition.addItem("executive");
              cbapposition.addItem("manager");
              gbc.fill=GridBagConstraints.BOTH;
              gbc.insets=new Insets(10,0,0,30);
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=1;
              gbc.gridy=4;
              g.setConstraints(cbapposition,gbc);
              panel.add(cbapposition);
              JButton submit=new JButton("submit");
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=0;
              gbc.gridy=5;
              g.setConstraints(submit,gbc);
              panel.add(submit);
              JButton reset=new JButton("reset");
              gbc.ipady=2;
              gbc.ipadx=2;
              gbc.gridx=1;
              gbc.gridy=5;
              g.setConstraints(reset,gbc);
              panel.add(reset);
              c.add(panel,BorderLayout.CENTER);
              c.setSize(500,400);
              c.setVisible(true);
         public static void main(String[] args)
              System.out.println("hi");
              Applicant a=new Applicant();
              System.out.println("there");
              try
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch(Exception e)
              System.out.println("hello");
              

    Ok, you know how to use the "bold" tags which do absolutely nothing to make the question clearer. Now learn how to use the "code" tags which will keep the codes original formatting and make the code easier to read, which in turn will make it easier for people to understand you code and provide some advice.

Maybe you are looking for

  • Problem with play video on TV

    sorry my english. I have problem with some VGA cards with TV-out. When i set on VGA properties clonning view / nView / and i play video via windows media player, on secondary monitor is blank screen - in media player. Desktop is show correctly.. Is t

  • Is a certain MAC recognizable by unwanted cookies, regardless of IP?

    Hi folks, I have been searching the web but I can´t seem to find a definitive answer to this quick question: If I visit a certain website (say a forum, like this) they most certainly log the I.P etc. But I hear all kind of horror stories that certain

  • Fill command no longer works, has turned into Grow

    I've been scouring sites for a solution and have not found one as of yet. My Edit/Fill command (shift + F5) has suddenly turned into Grow. I've seen other people with this problem and the only solution I have seen up to now is to use (shift + delete)

  • Dynamic Webserver in OpenDoc

    Hi, Is there a way to specify the CurrentWebServer in the Opendocument function within a crystal report. We are using the link as http://<devwebserver>:8080/OpenDocument/opendoc/logonVintela.do?appKind=InfoView&sRefresh=Y&isApplication=true&sType=rpt

  • Enhanced Organizational Model

    Hi Experts, We have switched to the Enhanced Organizationa model. After this, We have downloaded Organizational Model from ECC using the program CRM_ORGMAN_R3_ORGDATA_GENERATE. Report result shows the multiple assignments for Sales groups to the Sale