A Question about popup keyword in ABAP programming

Hello Expert,
When I write ABAP code like following statement,
START-OF
The system will popup a help window to suggest the relevant ABAP keyword. in this case, the popup keyword is START-OF-SELECTION.
My question is, if the popup keyword is what i want, how can i select the popup keyword. I tried ''ENTER' key when the keyword popup, but it doesn't work.
Can any expert tell me how to to set the hot key to select the popup keyword? Your help will greatly speed up my development.
Thanks in advance,
Best Regards, Yongbo.

Hi Yongbo,
Use Tab key instead of Enter. If you want to use Enter for code completion, check out [OSS note 1042863|https://service.sap.com/sap/support/notes/1042863|Note 1042863 - Inserting code hints using the ENTER key].
Cheers, harald

Similar Messages

  • Questions about the Apple Developer Enterprise Program

    Hi there,
    i got some questions about the Apple Developer Enterprise Program:
    - is there a way a company can create their own "AppStore" with only the APPs the employees should use?
    - when I developed the enterprise app are the install files on a apple hosted server or do i need my own infrastructure to distribute my app?
    Thanks in advance for answers!

    Google: MDM

  • Question about adding keywords to a group of images in Aperture

    Hi all,
    Not sure what I am doing incorrectly, but I am unable to add a keyword to more than 1 image at a time, even though a group of images is selected. So, for example, in Browser view, with 4 images selected, using the keyword HUD, I drag a keyword to one of the selected images, and only the one dragged to gets that keyword, not the others in the group.
    Any ideas?
    Thanks
    Aperture 3.1.1

    Hi Pi,
    Not quite sure what the purpose of that button is.
    You'll laugh about this sometime not too long from now. Sometime, you will have a bunch of photos selected and *not want to change your selection*, but you'll notice that you need to add some metadata or adjust just 1 of those pictures. That's when you use the "primary only". When you find yourself in that situation, it'll be like a "eureka" since you're currently wondering what it's all about.
    nathan

  • Question about using enumeration in a program

    I've seen some of the other posts about enumeration in this forum, but it does not address a particular question that I have.
    What I'm attempting to do, is to enumarate some SMTP server response codes so that I can effectively use them in a switch. In Java, you don't enum like you do in C. So I pulled out a reference manual and copied some code from that.
    Given the code (at bottom of this post) which I am using from the book example, I created a class for which is supposed to enumerate some message responses from an SMTP server. (there are only a few of the 21 responses that I inetend to create.)
    The book goes on to show how one might use this in a construct.
    From another class outside of StatusCode, I use the follow construct:
    enum StatusCode {"211", "214", "220", "221", "250", "251", "354", "421"}; }
    However, my compiler complains when I attempt to compile this. Says it's expecting a ";" at line XX.
    Can somebody help or redirect me to a better way to handle response codes coming back in a J2ME (MIDlet) input stream?
    Thanks in advance,
    Mike
    ====the code====
    public final class StatusCode {
    public static final int
    SYSTEMHELP_REPLY = 1, //211 System
    HELPMSG = 2, //214 Help message
    SERVICEREADY = 3, //220 <domain> Service ready
    SERVICECLOSING = 4, //221 <domain> close channel
    REQUESTCOMPLETED = 5, //250 action okay, completed
    USERNOT_LOCAL_WILL_FORWARD = 6, //251 User not local
    STARTMAIL_INPUT = 7, //354 Start mail input; end
    public static final StatusCode SYSTEM_HELP = new StatusCode(
    SYSTEMHELP_REPLY);
    public static final StatusCode HELP_MSG = new StatusCode(_HELP_MSG);
    public static final StatusCode SERVICE_READY = new StatusCode(_SERVICE_READY);
    public static final StatusCode SERVICE_CLOSING = new StatusCode(
    SERVICECLOSING);
    public static final StatusCode REQUEST_COMPLETED = new StatusCode(
    REQUESTCOMPLETED);
    public static final StatusCode USER_NOT_LOCAL_WILL_FORWARD = new StatusCode(
    USERNOT_LOCAL_WILL_FORWARD);
    public static final StatusCode START_MAIL_INPUT = new StatusCode(
    STARTMAIL_INPUT);
    public int value() {
    return _value;
    public static final StatusCode from_int(int i) {
    return SYSTEM_HELP;
    private StatusCode(int _value){
    this._value=_value;
    private int _value;

    This isn't C code.
    This came right out of my Java reference manual.
    Maybe the author was on acid?
    LOL
    He's actually talking abou IDL enum. Is that the same thing that I'm trying to accomplish?

  • Question about XML mapping to ABAP internal table

    Hi experts.
    I'm trying to XML mapping. But it doesn't work well. Assume there are XML file as below.
    <HEADER>
      <ITEM>
        <FOO>123</FOO>
        <BAR>ABC</BAR>
      </ITEM>
      <ITEM>
        <FOO>456</FOO>
        <BAR>DEF</BAR>
      </ITEM>
    <HEADER>
    and I want to trasformation it as below.
    ITAB
    FOO       |      BAR
    123         |  ABC
    456         | DEF
    How could I trasformation using "call transformation"?
    Regards.

    Hi,
    REPORT  zind_xml_to_sap NO STANDARD PAGE HEADING.
    Data Declaration                                                    *
    DATA: client      TYPE REF TO if_http_client, "Interface
          host        TYPE string,
          port        TYPE string,
          proxy_host  TYPE string,
          proxy_port  TYPE string,
          path        TYPE string,
          scheme      TYPE i,
          xml         TYPE xstring,
          response    TYPE string.
    DATA: t_xml       TYPE smum_xmltb OCCURS 0 WITH HEADER LINE.  "XML Table structure used
                                                                  "for retreive and output XML doc
    DATA: g_stream_factory TYPE REF TO if_ixml_stream_factory.    "Interface
    DATA : return  LIKE  bapiret2 OCCURS 0 WITH HEADER LINE.      "XML Table structure used for retreive
                                                                  "and output XML doc
    Parameters                                                          *
    PARAMETER : p_add TYPE string LOWER CASE ,
                p_dfile   LIKE rlgrap-filename.
    AT Selection-Screen on value-request for file                       *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dfile.
    Get file
      PERFORM 100_get_file.
    Start-of-Selection                                                  *
    START-OF-SELECTION.
    Perform to upload xml data from URL to SAP internal table
      PERFORM 200_xml_upload.
      IF t_xml[] IS NOT INITIAL.
      Perform to Download data from Internal Table to a text file in local drive
        PERFORM 300_download.
        write : / 'Data Uploaded to Internal Table Successfully'.
        write : / 'XML Data Downloaded to Local path', p_dfile.
      else.
        write : / 'No Data for upload'.
      ENDIF.
    *if t_xml[] is INITIAL.
    WRITE : address, 'Given URl cannot be Converted' .
    else.
    LOOP AT t_xml .
       WRITE:  t_xml-cname, t_xml-cvalue.
    ENDLOOP.
    endif.
    *&      Form  get_file
          Get File
    FORM 100_get_file .
      CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME        = SYST-CPROG
        DYNPRO_NUMBER       = SYST-DYNNR
        FIELD_NAME          = ' '
       IMPORTING
         file_name           = p_dfile
    ENDFORM.                    " 100_get_file
    *&      Form  200_xml_upload
          form to upload xml data from URL to SAP internal table
    FORM 200_xml_upload .
    *Check HTTP:// and concatenate
      IF p_add NS 'http://' OR p_add NS 'HTTP://'.
        CONCATENATE 'http://' p_add
                    INTO p_add.
      ENDIF.
    Fetching the address of the URL
      CALL METHOD cl_http_client=>create_by_url
        EXPORTING
          url    = p_add
        IMPORTING
          client = client.
    *Structure of HTTP Connection and Dispatch of Data
      client->send( ).
    *Receipt of HTTP Response
      CALL METHOD client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2
          http_processing_failed     = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        IF sy-subrc = 1.
          MESSAGE 'HTTP COMMUNICATION FAILURE' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSEIF sy-subrc = 2.
          MESSAGE 'HTTP INVALID STATE' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSEIF sy-subrc = 3.
          MESSAGE 'HTTP PROCESSING FAILED' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSE.
          MESSAGE 'Problem in HTTP Request' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ENDIF.
      ENDIF.
    Get data of the xml to Response
      response = client->response->get_cdata( ).
    *FM converting the XML format to abap
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = response
        IMPORTING
          buffer = xml.
    *FM converting XMl to readable format to a internal table.
      CALL FUNCTION 'SMUM_XML_PARSE'
        EXPORTING
          xml_input = xml
        TABLES
          xml_table = t_xml
          return    = return.
    ENDFORM.                    " 200_xml_upload
    *&      Form  300_download
    *form to Download data from Internal Table to a text file in local drive
    FORM 300_download .
      DATA filename TYPE string.
      filename = p_dfile.
      CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = filename
        WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        data_tab                        = t_xml
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
      IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.

  • Javascript/html question about popup window title

    I am displaying an uploaded pdf file using wpg_docload.download_file in a popup window (using javascript open).
    How can I change the title of this popup window.

    Thanks to Jes (John Scott at shellprompt.net) for a solution for my version of this problem; set the Content-Disposition in the HTTP header to indicate your required filename. Example:
    I have an 'On-Load - Before Header' process on the ApEx page I want to use 'host' my PDF document generator. The page is called from a popup JavaScript call, allowing us to rely on ApEx authorisation and authentication. The Source of this process looks like the following:
    declare
    myblob blob;
    begin
    -- Call procedure to gereate PDF document in a blob and pass it back
    myprocedure_to_generate_blob( in_parameter, in_parameter, myblob);
    owa_util.mime_header('application/pdf',false);
    htp.p('Content-Length: ;||dbms_lob.getlength(myblob));
    -- This line sets the filename (which could be dynamic)
    htp.p('Content-Disposition: attachment;filename=mypdffile.pdf');
    owa_util.http_header_close;
    wpg_docload.download_file(myblob);
    -- Stop Apex from trying to render more of the page (we've finished)
    htmldb_application.g_unrecoverable_error := true;
    end;

  • Questions about controlling fans.. using programs like smcFan Controll

    I am in Brazil and the high of the day is like in the 80's so my temps on my MacBook Pro jump to 150 F, I was wondering if I should use a program to increase my fan speed. For some reason even if the temps jump to 150 (F) my Mac doesn't up my fan speed. Is that normal? Should I use some program, such as smcFan Control to up my RPM's on the fans?
    Thanks for the responses!

    Yes, from anecdotal reports here that seems to be true, but it's not much sooner — just a little.
    But it isn't the operating system that makes the difference; it's that the hardware itself is tuned a little differently. From the fact that your machine was able to run OS X 10.5.8, I was able to tell that it wasn't one of the newer machines. It may be that the threshold of danger from overheating with the i5 and i7 processors is a bit lower than the 105°C/221°F for your Core 2 Duo; I don't know for sure.

  • A few questions about the apple individual developer program

    1. Are there any age lower limits to join the apple individual developer program?
    2. How many UDID spots for iOS developer-access-only beta build devices can i register if i own an apple individual developer program account?
    Thanks!

    Thank you, but what if I continue my membership the next year(i know that i have to pay USD$99 again),
    will I get 100 more NEW empty slots next year while my previous 100 registered slots are still in effect?
    Sorry i have clicked the "correct answer" button accidentally on myself

  • How to add Abap program in process chain to check the another process chain status and do accordingly

    Hello All,
    My requirement is related to process chain 1 . I have one process chain in that i have to  put abap program in middle of that chain . This program will check the status of one another process chain 2 status ( whether it was completed or it is going on). if it is completed then continue the Process chain 1  to further activity else wait to complete Process chain 2 .
    Here i have to use process chain 2 as a parameter.
    Kindly provide me solution .
    Regards
    Saurabh

    Hi Saurabh,
    You need to create ABAP program in which you check the values for required process chain in
    following table
    RSPCLOGCHAIN (Feilds ANALYZED_STATUS LOG_ID)
    Depend on values you can trigger next process or you can wait unitil this process chain complete.you need to check status from table using ABAP.
    If you are not aware about how to write ABAP program then take help from ABAP Team.
    Regards,
    Ganesh Bothe

  • Is a save step neccessary in a Process Chain when loading hierarchies with an ABAP program?

    We are loading hierarchies using the ABAP routine found here in the SDN. 
    We have come accross the issue where the process chain loads successfully, but does not update the hierarchy (this problem is documented in the SDN).  It is not a consistent issue, but it causes problems when it does occur.
    OSS note 652856 points out that a SAVE HIERARCHY step is needed after the load and before the Change Attribute run.
    We have added the step to the process chain, which leads me to the question.
         In using the ABAP program to load hierarchies is the addition of the Save Hierarchy step necessary?
         Will that resolve the issue with hierarchies not updating?

    Hi Bill,
    Yes, SAVE HIERARCHY step is required when hierarchies are loaded as part of process chain. This step ensures that the hierarchy data loaded to BW has been saved. Then we have to run ACR so that these hierarchies will be activated and adjusted.
    This is the reason why even the hierarchy data loaded using infopackage needs this step. This step is not required if the Infopackage is triggered manually.
    This link will help you in better understanding
    http://help.sap.com/saphelp_nw04/helpdata/en/3d/320e3d89195c59e10000000a114084/content.htm
    Regards
    Chandu

  • Question about using TVARV in an ABAP program

    Hello gurus, Im sorry about the silly question.
    I have a question about using TVARV in an ABAP program.
    A program is presenting a problem and I think that in this code:
    SELECT SIGN OPTI LOW HIGH
      FROM TVARV
      INTO TABLE R_1_163431035_VELOCIDADE
      WHERE  NAME = '1_163431035_VELOCIDADE'
      AND    TYPE = 'S'.
      IF ZMM001-VELOCIDADE_B   IN R_1_163431035_VELOCIDADE AND
          ZOPERADORAS-OPERADORA = 'ABCD' AND
          ZMM001-MATERIAL       IN R_1_163431035_PRODUTO.
      ELSE.
      ENDIF.
    What happens is that the value "ZMM001-SPEED" B not exist in "R1_163431035_VELOCIDADE" but the program executes commands under the IF and not under the ELSE, as I imagine it would work. Is this correct ?
    I am new to ABAP programming, but I have a lot of XP in other programming languages ​​and this makes no sense to me.
    Anyone know where I can find some documentation of the use of "TVARV" in ABAP programs?
    I search the Internet if other programmers use TVARV this way, but found nothing, which leads me to think that was a quick and dirty solution that used here.
    If this is a bad way to program, what would be the best way?
    Regards
    Ronaldo.

    Hi Ronaldo,
    But in this case, the range is not empty, there are 17 records, in this way.:
    For the column "SING" all values ​​are "E"
    It means that the result is false if ZMM001-VELOCIDADE_B has the same value as one of the 17 records (E = exclude).
    For instance, if it has value 'C' and one of 17 records matches C, then the result is false.
    The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
    Yes, the same behavior as the selection criterion to be exact. You can press the help key in the complex selection dialog for more info.
    I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator, but I think they work in different ways, so I would like to understand how it works in ABAP.
    Not silly ;-). Yes they work differently.
    More info here:
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba74635c111d1829f0000e829fbfe/frameset.htm
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm
    BR
    Sandra

  • Basic Questions of ABAP programming

    Hi Experts
    I am new for ABAP programming. I wants to know some basic about ABAP. I have done 2 months ABAP course from a institute. They give me training on 4.7 IDES ver. Please give the answers of following questions.
    1.Is there big difference between 4.7 and 6.0 Ecc ver in ABAP programming point of view?
    2.for Traing purpose Should I install the full verson of SAP or there is any dummy software?
    3.SAP Netweaver knowledge is must for ABAP programing?
    4. When we install SAP 4.7 IDES version then all the modules will avialable or Only ABAP?
    Thanks
    Best Regards
    Jitender

    Hello,
    For your own practice you can download the free version of SAP Netweaver ABAP in the downloads section of SCN. This is only for ABAP development. You wont find many of the stadard tables and functionalities with in it. IDES should be containing all the modules. But again that depends on the licesnse with which you are provided.
    Your questions have no relevance from the ABAP technical point of view except the first one which is a basic question and should be asked here as per the forum rules. Thats the reason why you were suggested to read the forum rules.
    For any queries of the trial version ABAP have a look at this forum
    Vikranth

  • ABAP Programming Guidelines not showing in ABAP Keyword Documentation

    We are currently in the process of upgrading to Netweaver 7.0 EhP2
    I have seen mentioned that the ABAP Keyword Documentation and ABAP Examples are now all provided in an improved ABAPDOCU transaction.  In addition, the ABAPDOCU transaction is meant to also have a section on ABAP Programming Guidelines. 
    I have seen a screen example of what the ABAPDOCU screen now looks like (as shown in the mockup below).  Our ABAPDOCU screen looks very similar except that there is no node for ABAP Programming Guidelines.
    That is an area that I would like to have a closer look at.  Have we missed something.  Is this available as part of the standard 7.0 EhP2 install or does it need to be installed separately (or perhaps is this only available in a higher EhP).  I've tried finding further information on this option but have not been able to come across anything.  Does anyone know what would be involved (or if it is possible) to make this available in EhP2 
    Greg Milici
    ABAP Developer
    ...V...ABAP Keyword Documentation
    .......>...ABAP Overview
    .......>...ABAP - Reference
    .......>...ABAP - Short Reference
    .......>...ABAP - Release-Specific Changes
    .......>...ABAP Programming Guidelines
    ............ABAP Glossary
    ............ABAP Index
    ............ABAP Subject Directory
       etc.

    Hi Greg,
    When [searching|http://help.sap.com/search/sap_trex.jsp] the [documentation for NW 7.0.2|http://help.sap.com/nw702/] for ABAP keyword there are several documents that mention how you can find more details about ABAP keywords. For example, [Data Consistency|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/41/7af4b6a79e11d1950f0000e82de14a/frameset.htm] mentions a menu in the ABAP Editor, and [New Features in Web Dynpro ABAP for Enhancement Package 2 (EhP2)|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/54/07ec96bd5a4764be4996fff231b4de/frameset.htm] mentions the ABAPHELP transaction.
    I suppose you could try to find if the documentation you need is installed on your system. Perhaps the [how do I Install SAP Document CD and SAP Library|how do I Install SAP Document CD and SAP Library; thread might be of help.
    Best regards,
    Rossen

  • A question about BC 400 training program

    Dear all,
    I have a question about SAP taining program for ABAP. My manager will soon register me for the training program BC 400, which seems to be the start point for those who don't know anything about ABAP. I was looking at the course description page and I saw that the course is provided as VLC (Virtual Class). As I understood is that the student connects from his workstation to the training center, so it is distant training program.
    I think it would be more interesting for me to be directly in the classroom with teacher face-to-face.
    Therefore, my qestion is the fact that a training program is VLC, does it mean that it is no more possible to attend directly in classes ? or is just for those who may not want for some reason attend directly to the class?
    Thanks in advance,
    Dariyoosh
    Moderator message: moved to S & C.
    Edited by: Thomas Zloch on Sep 6, 2010 2:33 PM

    This is forum for general abap problems.but to answer your question
    check this link from sap site
    http://www.sap.com/usa/services/education/tabbedcourse.epx?context=[[|bc400||1|063|us|]]|
    Thanks
    Bala Duvvuri

  • Questions about a MasterQuize program

    Hi, everyone.
    I got a in-class case study program like this in the class:
    * This class stores/represents a question that has one of two
    * answers: True or False.
    * <p></p>
    * It needs to track the following information:
    * <ul>
    * <li>Question text</li>
    * <li>Correct answer</li>
    * <li>The user's answer to the question</li>
    * <li>Points value</li>
    * <li>Category</li>
    * <li>Difficulty rating</li>
    * </ul>
    // Our question should allow us to do the following:
    // - Create question (constructor) -- may be overloaded
    // - Print (display) question
    // - Check client's answer for correctness
    // - Get points value for question (0 or max)
    //   - Add "No-BS" grading option
    // - Getting client's answer
    // - Check to see if answered by client
    public class TrueFalseQuestion
        // Class constants (to simplify changes to common values)
        public static final int MIN_DIFFICULTY_LEVEL = 1;
        public static final int MAX_DIFFICULTY_LEVEL = 5;
        public static final int DEFAULT_DIFFICULTY_LEVEL = 1;
        public static final int DEFAULT_POINT_VALUE = 1;
        public static final String DEFAULT_CATEGORY_VALUE = "none";
        // Class instance variables
        private String questionText;
        private String correctAnswer;
        private String userAnswer;
        private int pointsValue;
        private String category;
        private int difficultyLevel; // TODO: Set a range for difficulty levels
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * @param ctgry Category keyword for this question
         * @param level The perceived/intended difficulty level of this question
         * <p></p>
         * Defines a TrueFalseQuestion object.
        public TrueFalseQuestion (String text, String answer, int pts, String ctgry, int level)
            // Set starting values for all instance variables
            questionText = text.trim();
            correctAnswer = answer.trim();
            userAnswer = null; // No user answer supplied yet
            if (pts >= 1) // We assume that every problem is worth at least 1 point
                pointsValue = pts;
            else
                pointsValue = DEFAULT_POINT_VALUE;
            category = ctgry.trim();
            if (level >= MIN_DIFFICULTY_LEVEL && level <= MAX_DIFFICULTY_LEVEL) // within range
                difficultyLevel = level;
            else
                difficultyLevel = DEFAULT_DIFFICULTY_LEVEL;
        // Simplified (overloaded) constructors
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * <p></p>
         * Defines a TrueFalseQuestion with default values for category and difficulty level.
        public TrueFalseQuestion (String text, String answer, int pts)
            // Call pre-existing constructor with default category and difficulty
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default point value, default category,
         * and default difficulty level.
        public TrueFalseQuestion (String text, String answer)
            // Call pre-existing constructor with default points, category and difficulty
            this(text, answer, DEFAULT_POINT_VALUE, DEFAULT_CATEGORY_VALUE,
                 DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * @param ctgry Category keyword for this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default difficulty level.
        public TrueFalseQuestion (String text, String answer, int pts, String ctgry)
            // Call pre-existing constructor with default points, category and difficulty
            this(text, answer, pts, ctgry,
                 DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param ctgry Category keyword for this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default point value and the default
         * difficulty level.
        public TrueFalseQuestion (String text, String answer, String ctgry)
            // Use default points and difficulty
            this(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * @param level The perceived/intended difficulty level of this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default value for the question category.
        public TrueFalseQuestion (String text, String answer, int pts, int level)
            // Use default category
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Clients can invoke this method to retrieve the text of the current question.
        // We chose to return the text instead of printing it; this allows the client
        // to decide how it should be presented (via a GUI, over a network, etc.)
        public String getQuestion ()
            return questionText;
        // This method allows the client to store the user's answer inside the
        // TrueFalseQuestion object for easy comparison
        public void submitAnswer (String ans)
            userAnswer = ans;
        // This method reports whether the submitted answer matches the correct answer
        public boolean answerIsCorrect(String userAns) // This version does all the work
            if (userAns == null) // No response from user (yet)
                return false;
            else
                // Normalize and compare answers
                char key = normalize(correctAnswer); // Get 't' or 'f'
                char ans = normalize(userAns); // Get 't' or 'f'
                return (key == ans);
        public boolean answerIsCorrect ()
            return answerIsCorrect(userAnswer); // Call previously-defined version
        public int getPointsValue()
            return pointsValue;
        // Return the points awarded for the user's answer. This method does
        // NOT support partial credit; answers are either correct or incorrect.
        // If the "No-BS" option is selected, blank (unanswered) questions receive
        // 1 point automatically; otherwise, the score will be either 0 or the
        // question's normal points value.
        public int getPointsEarned(boolean useNoBSRule)
    System.out.println("useNoBS: " + useNoBSRule + "\tuserAnswer: " + userAnswer + "\tcorrectAnswer: " + correctAnswer);
            if (useNoBSRule && (userAnswer == null))
                return 1;
            else if (userAnswer == null)
                return 0; // Without "No-BS", treat blank problems as incorrect
            if (answerIsCorrect() == false)
                return 0;
            else
                return pointsValue;
        // This method returns true if the user has submitted an answer
        // for this question (regardless of whether that answer is correct)
        public boolean hasBeenAnswered ()
            return (userAnswer != null);
        // Private helper method to convert all answers to single lowercase
        // letters (in this case, 't' for TRUE and 'f' for FALSE)
        private char normalize (String input)
             if (input != null)
                  input = input.trim(); // Remove leading whitespace
                  input = input.toLowerCase();
                  return input.charAt(0);
             else
                  return ' ';
    import java.util.*;
    * This class represents a complete test or quiz.
    * Data stored:
    * - List of questions
    * - Total score earned
    * - Total score possible
    * - Name/title of test
    * - Instructions
    *  - Category/class assignment
    *  - Student (test-taker) name
    *  - Date test is/was taken
    *  - Time started
    *  - Time completed
    *  - Maximum time allotted
    *  - (List of) Maximum attempts per question
    *  - List of attempts per question
    *  - List of difficulty ratings per question
    *  - Assignment weight
    * Methods:
    * - Constructor
    * - Add question
    * - Display question
    * - Display test
    * - Display instructions
    *      - Generate random exam
    * - Take/administer test
    * - Get score
    * STUFF TO DO:
    * - Add time/date restrictions
    * - Add network access restrictions
    * - Add other restrictions/allowances?
    * @author (your name)
    * @version (a version number or a date)
    public class Test
        // Class constant
        public static final int MAX_NUMBER_OF_QUESTIONS = 10;
        // Class instance variables
        private String testName;
        private int scoreEarned; // What the student earned on the exam
        private int scorePossible; // Total point values of all questions
        private String instructions; // Exam header text
        private ArrayList<TrueFalseQuestion> questions; // Create inside constructor
        // Methods
        public Test (String name, String instr)
            testName = name;
            scoreEarned = 0;
            scorePossible = 0;
            instructions = instr;
            questions = new ArrayList<TrueFalseQuestion>(); //[MAX_NUMBER_OF_QUESTIONS];
        public String getInstructions()
            return instructions;
        public int getScore()
            return scoreEarned;
        public void addQuestion (TrueFalseQuestion q)
            scorePossible += q.getPointsValue();
            questions.add(q); // Automatically append question to end of test
        public String displayQuestion (int position)
            if (position < questions.size())
                return (position+1) + ". " + questions.get(position).getQuestion();
            else
                return null;
        public String displayTest ()
            String result = "";
            for (int i = 0; i < questions.size(); i++)
                result += (i+1) + ". (";
                TrueFalseQuestion t = questions.get(i);
                result += t.getPointsValue();
                result += " points)\n\n" + displayQuestion(i);
                result += "\n\n";
            return result;
        // Get test length (number of questions)
        public int length ()
             return questions.size();
        // Submit answer to a specific question
        public boolean answer(int number, String a)
             // Question numbers run from 0-(max-1) -- THIS WAS AN OFF-BY-ONE ERROR AT FIRST
             if (number >= 0 && number < questions.size())
                  TrueFalseQuestion t = questions.get(number);
                  t.submitAnswer(a);
                  return true; // Question was answered
             else
                  return false; // Unable to answer (nonexistent) question
        // Score exam
        public void scoreExam (boolean useNoBS)
             scoreEarned = 0;
             for (int i = 0; i < questions.size(); i++) // For each question in exam
                  TrueFalseQuestion t = questions.get(i); // get current question
                  scoreEarned += t.getPointsEarned(useNoBS);
    }// Test harness for the Test and *Question classes
    import java.util.*;
    public class QuizDriver
         public static void main(String[] args)
              // Create a new Test object
              Test exam = new Test("Sample Exam", "Select the correct answer for each question");
              setUp(exam);
              Scanner sc = new Scanner(System.in);
              System.out.println(exam.getInstructions());
              // Administer exam
              for (int i = 0; i < exam.length(); i++)
                   // Print out current question
                   System.out.println(exam.displayQuestion(i));
                   // Get user answer
                   System.out.print("Your answer: ");
                   String ans = sc.nextLine();
                   if (ans.equals("")) // Handle blank responses for unanswered questions
                        ans = null;
                   exam.answer(i, ans);
              // Get exam results
              exam.scoreExam(true);
              System.out.println("Your final score was " + exam.getScore() + " points.");
         private static void setUp (Test t)
              TrueFalseQuestion x = new TrueFalseQuestion("The sky is blue.", "true", 2);
              t.addQuestion(x);
              x = new TrueFalseQuestion("The first FORTRAN compiler debuted in 1957", "true", 5);
              t.addQuestion(x);
              x = new TrueFalseQuestion("Spock was a Vulcan", "false", 3);
              t.addQuestion(x);
    }This program is far from finishing.
    I have many questions about this program, but let me ask this one first:
    In the TrueFalseQeustion class, why are there so many constructors? What is the purpose of setting some of the variables to default values?
    Thank you very much!!!
    Edited by: Terry001 on Apr 16, 2008 10:02 AM

    newark wrote:
    Stop ignoring the error messages. You seem to think that an error message means you're doing the assignment wrong. It's probably a simple fix. Post the exact error messages, as well as the code that corresponds to them. The error message will tell you exactly what line the problem occurs on, so you know right where to look.Hi,
    After some modifications, the program now gives me the result the assignment wants when I run it. But I still have trouble with the MultipleChoiceQuestion class
    Here is the complete program
    QuizDriver class
    // Test harness for the Test and *Question classes
    import java.util.*;
    public class QuizDriver
         public static void main(String[] args)
              // Create a new Test object
              Test exam = new Test("Sample Exam", "Select the correct answer for each question");
              setUp(exam);
              Scanner sc = new Scanner(System.in);
              System.out.println(exam.getInstructions());
              // Administer exam
              for (int i = 0; i < exam.length(); i++)
                   // Print out current question
                   System.out.println(exam.displayQuestion(i));
                   // Get user answer
                   System.out.print("Your answer: ");
                   String ans = sc.nextLine();
                   if (ans.equals("")) // Handle blank responses for unanswered questions
                        ans = null;
                   exam.answer(i, ans);
              // Get exam results
              exam.scoreExam(true);
              System.out.println("Your final score was " + exam.getScore() + " points.");
         private static void setUp (Test t)
                                   Question x;
              x = new TrueFalseQuestion("The sky is blue.", "true", 2);
              t.addQuestion(x);
              x = new TrueFalseQuestion("The first FORTRAN compiler debuted in 1957", "true", 5);
              t.addQuestion(x);
              x = new TrueFalseQuestion("Spock was a Vulcan", "false", 3);
              t.addQuestion(x);
              x = new MultipleChoiceQuestion("What is the color of the car\na.Red\nb.Green", "a. Red", 3);
              t.addQuestion(x);
              x = new MultipleChoiceQuestion("What is the name of this class\na.CSE110\nb.CSE114", "b, CSE114", 3);
              t.addQuestion(x);
    }Test
    public class Test
        // Class constant
        public static final int MAX_NUMBER_OF_QUESTIONS = 10;
        // Class instance variables
        private String testName;
        private int scoreEarned; // What the student earned on the exam
        private int scorePossible; // Total point values of all questions
        private String instructions; // Exam header text
        private ArrayList<Question> questions; // Create inside constructor
        // Methods
        public Test (String name, String instr)
            testName = name;
            scoreEarned = 0;
            scorePossible = 0;
            instructions = instr;
            questions = new ArrayList<Question>(); //[MAX_NUMBER_OF_QUESTIONS];
        public String getInstructions()
            return instructions;
        public int getScore()
            return scoreEarned;
        public void addQuestion (Question q)
            scorePossible += q.getPointsValue();
            questions.add(q); // Automatically append question to end of test
        public String displayQuestion (int position)
            if (position < questions.size())
                return (position+1) + ". " + questions.get(position).getQuestion();
            else
                return null;
        public String displayTest ()
            String result = "";
            for (int i = 0; i < questions.size(); i++)
                result += (i+1) + ". (";
                Question t = questions.get(i);
                result += t.getPointsValue();
                result += " points)\n\n" + displayQuestion(i);
                result += "\n\n";
            return result;
        // Get test length (number of questions)
        public int length ()
             return questions.size();
        // Submit answer to a specific question
        public boolean answer(int number, String a)
             // Question numbers run from 0-(max-1) -- THIS WAS AN OFF-BY-ONE ERROR AT FIRST
             if (number >= 0 && number < questions.size())
                  Question t = questions.get(number);
                  t.submitAnswer(a);
                  return true; // Question was answered
             else
                  return false; // Unable to answer (nonexistent) question
        // Score exam
        public void scoreExam (boolean useNoBS)
             scoreEarned = 0;
             for (int i = 0; i < questions.size(); i++) // For each question in exam
                  Question t = questions.get(i); // get current question
                  scoreEarned += t.getPointsEarned(useNoBS);
    }Question
    public class Question
    // Class constants
      public static final int MIN_DIFFICULTY_LEVEL = 1;
      public static final int MAX_DIFFICULTY_LEVEL = 5;
      public static final int DEFAULT_DIFFICULTY_LEVEL = 1;
      public static final int DEFAULT_POINT_VALUE = 1;
      public static final String DEFAULT_CATEGORY_VALUE = "none";
      // Class instance variables
      protected String questionText;
      protected String correctAnswer;
      protected String userAnswer;
      protected int pointsValue;
      protected String category;
      protected int difficultyLevel; //TODO: set a range for difficulty levels
      // Constructors
      public Question (String text, String answer, int pts, String ctgry, int level)
          questionText = text.trim();
          correctAnswer = answer.trim();
          userAnswer = null;
          if (pts >= 1)
              pointsValue = pts;
            else
                pointsValue = DEFAULT_POINT_VALUE;
            category = ctgry.trim();
            if (level >= MIN_DIFFICULTY_LEVEL && level <= MAX_DIFFICULTY_LEVEL)
                difficultyLevel = level;
            else
                difficultyLevel = DEFAULT_DIFFICULTY_LEVEL;
        // Overloaded (simplied) constructors
        public Question (String text, String answer, int pts)
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
        public Question (String text, String answer, int pts, String ctgry)
            this(text, answer, pts, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public Question (String text, String answer, String ctgry)
            this(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public Question (String text, String answer, int pts, int level)
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Methods
        public String getQuestion ()
            return questionText;
        // Use this method to store user answers
        public void submitAnswer (String ans)
            userAnswer = ans;
        public boolean answerIsCorrect (String userAns)
            if (userAns == null)
                return false;
            else
                // Normalize and compare answers
                char key = normalize (correctAnswer); //Get the first letter of an answer
                char ans = normalize (userAns); //Get the first letter of an answer
                return (key == ans);
        public boolean answerIsCorrect ()// Why do we need two answerisCorrect() methods?
            return answerIsCorrect (userAnswer);
        public int getPointsValue ()
            return pointsValue;
        public int getPointsEarned (boolean userNoBSRule)
            System.out.println ("useNoBS: " + userNoBSRule + "\tuseAnswer: " + userAnswer + "\tcorrectAnswer: " + correctAnswer);
            if (userNoBSRule && (userAnswer == null))
                return 1;
            else if (userAnswer == null)
                return 0;
            if (answerIsCorrect() == false)
                return 0;
            else
                return pointsValue;
        public String getCorrectAnswer ()
            return correctAnswer;
        public boolean hasBeenAnswered ()
            return (userAnswer != null);
        private char normalize (String input)
            if (input != null)
                input = input.trim();
                input = input.toLowerCase();
                return input.charAt(0);
            else
                return ' ';
           TrueFalseQuestion
    public class TrueFalseQuestion extends Question
      public TrueFalseQuestion (String text, String answer, int pts, String ctgry, int level)
          super(text, answer, pts, ctgry, level);
        public TrueFalseQuestion (String text, String answer, int pts)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
        public TrueFalseQuestion (String text, String answer, int pts, String ctgry)
            super(text, answer, pts, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public TrueFalseQuestion (String text, String answer, String ctgry)
            super(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public TrueFalseQuestion (String text, String answer, int pts, int level)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Methods
        public String[] getPossibleAnswerChoice ()
            String[] possibleAnswerChoice = {"true", "false"};
            return possibleAnswerChoice;
    } MultipleChoiceQuestion
    public class MultipleChoiceQuestion extends Question
       public MultipleChoiceQuestion (String text, String answer, int pts, String ctgry, int level)
           super(text, answer, pts, ctgry, level);
        public MultipleChoiceQuestion (String text, String answer, int pts)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
        public MultipleChoiceQuestion (String text, String answer, int pts, String ctgry)
            super(text, answer, pts, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public MultipleChoiceQuestion (String text, String answer, String ctgry)
            super(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public MultipleChoiceQuestion (String text, String answer, int pts, int level)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Methods
        String possibleAnswers;
        public String getPossibleAnswers ()
            return possibleAnswers;
        public void addAnswerChoice (String answerChoice)
            String ansChoice = answerChoice;
            questionText += "\nansChoice";
            possibleAnswers = answerChoice;
        public void printAnswerChoice ()
            System.out.println (questionText);
    } I don't understand why the assignment wants me to build a method in the MultpleChoiceQuestion class to store the potential answer choices, I can make the program display the potential answer choices by including them in the questionText as following in the QuizDriver class
    Question x;
    x = new MultipleChoiceQuestion("What is the color of the car\na.Red\nb.Green", "a. Red", 3);
    t.addQuestion(x); I don't know how to allow the client to construct the list of answer choices one at a time(add one potential answer choice by calling the addAsnwerChoices() method once)
    Here are a few original sentences of my assignment which describe what I should do with the MultipleChoiceQuestion class
    Using TrueFalseQuestion as a model, develop a new MultipleChoiceQuestion class that can be used to represent a problem where the user must select one of several answer choices (e.g., "Select answer (a), (b), (c), or (d)."). This new question type should have all of the same externally-visible functionality as TrueFalseQuestion, except that it must:
    maintain a list of potential answer choices
    provide a method that allows the client to construct the list of answer choices one at a time (i.e., the client should be able to call an addAnswerChoice() method to pass a new answer option to the MultipleChoiceQuestion.)
    display (as part of the question text) the list of answer choices with appropriate letters ("abcd" instead of "0123") I don't understand what these sentences mean.
    1. "Maintain a list of potential answer choices"-- this reminds me of the getPossibleAnswerChoice() method in the TrueFalseQuestion class
    public String[] getPossibleAnswerChoice ()
            String[] possibleAnswerChoice = {"true", "false"};
            return possibleAnswerChoice;
        }I wonder that if the potential answer choices I have to store in the MultipleChoiceQuestion class are only letters "a", "b", "c", "d", etc, or include the answer text coming after the letters(eg. a.Red, b.Green)
    2. "provide a method that allows the client to construct the list of answer choices one at a time". How do I achieve the functionality "one at a time"? Do I need to pass the input of the client (a potential answer choice) to the variable of the method which stores the list of potential answers?
    3. "display (as part of the question text) the list of answer choices with appropriate letters". My question here is that: When the client type in one possible answer, should I append it to the variable questionText? (So I use the questionText variable in the methods of the first and second steps)
    Thank you very much for your nice help!
    Edited by: Terry001 on Apr 21, 2008 8:01 AM

Maybe you are looking for

  • Mdworker deny mach-lookup. But macbook won't boot in safe mode

    I have a common problem, I get theese messages every now and then in console: 2/8/13 6:38:24.000 PM kernel[0]: Sandbox: sandboxd(793) deny mach-lookup com.apple.coresymbolicationd 2/8/13 6:38:24.534 PM sandboxd[793]: ([791]) mdworker(791) deny mach-l

  • How to copy links

    I need help, because i'm creating a web page and i'm traying to copy links, but i can't. I make the selction + control (copy link), but doesn't copied. Probably i've to configure sometghing to be able to copy the links without problems. This problem

  • PLEASE fix the answer call swipe gesture!

    I have no trouble with any other gestures on the phone - they are beautifully responsive - and yet I am constantly missing calls while my finger is on the phone swiping at a circle graphic which gets halfway to the left and then flings back to centre

  • Well, let's say I wanted to do a puzzle.

    It's not exactly what I'm trying to do, but I think a puzzle is a good way of describing the problem at hand. I want to lay out one new piece every time I choose the "new piece" option from a menu. Obviously the pieces I've already laid down should n

  • Backup Radius on router

    I have the primary Radius server working just fine but when I stop the primary Radius server the backup radius server does not work, it fails over to the local password. I have included the config, does anybody have any idea why it won't fail over to