Want to Pick a Random...Errors!

Hey, I wanted to take a user inputed number and pick a random number bewteen than and 1, so I put together the code...but I have errors galore! Isn't this the correct way?
import cs1.Keyboard;
public class pickRandom
     public static void main (String [] args)
          int n1 = 0;
          System.out.println("This program will take a number you enter and return a number between that number and one");
          System.out.println("Please enter a positive number: ");
          n1 = Keyboard.readInt();
          public double pickRandom(double 1, double n1); {
               System.out.println(pickRandom);
}

no.
First: what's this "public double pickRandom(...) {...}" function definition doing INSIDE your main function? put it inside the class but outside the main method.
Second: it uses a variable that is not defined in its scope (namely, "pickRandom")
Third: do not name a method the same as the class it's in
Fourth: the pickRandom method does not return a double, as it claims to.
Fifth: nowhere you you actually have any code do any randomization. Try (int)(Math.random() * n1);
Sixth: the pickRandom method does not use either of the parameters it is passed
Seventh: the pickRandom method is never called
Eighth: the pickRandom method calls one of its parameters "1" which is an illegal name since it's used for the number 1.

Similar Messages

  • Picking a random letter...

    I want to pick a random letter from a string.
    This is what I have...
    char RANDOM_letter;
    String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    RANDOM_letter = ??;

    or, to do it your way:   
    char RANDOM_letter;
    String availableLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int randNum = randomNumberBetween(0, availableLetters.length());
    RANDOM_letter = availableLetters.charAt(randNum);
        *   Returns random number between min & max, INCLUSIVE of min & max:
        private int randomNumberBetween(int min, int max)      
            max++;  //makes range *include* min & max
            int num = (int)( (Math.random()*(max-min)) + min);
            return num;
        }

  • Oracle client 9.2.0.7 ora-01403 random error

    I updated my Oracle Client to 9.2.0.7 version and since this time I have a random error.
    It seems that the transaction abort some time, because I have ORA-01403 when I create the insert and just after the select into clause has the error.
    I don't want to trap error for security.
    Is anybody has the same type of error and how to resolve it?
    Thanks

    "No No No pl/sql codes are changed in the Db and No line of code are changed in .Net application"
    But all of the errors you have listed so far are data errors. Has any data changed in the last 3 years?
    ORA-02291 means that you are trying to insert a record into a child table that has no corresponding record in the parent table.
    SQL> CREATE TABLE t (id NUMBER NOT NULL PRIMARY KEY,
      2                  descr VARCHAR2(10));
    Table created.
    SQL> CREATE TABLE t1 (id NUMBER NOT NULL REFERENCES t(id),
      2                   other_desc VARCHAR2(10));
    Table created.
    SQL> INSERT INTO t1 VALUES (1, 'One');
    INSERT INTO t1 VALUES (1, 'One')
    ERROR at line 1:
    ORA-02291: integrity constraint (OPS$ORACLE.SYS_C0099966) violated - parent key not foundNo triggers, not even an Oracle client since I am logged into the database server.
    One more time, your random errors have nothing to do with the client version, and everything to do with the data in your database (or the lack of it for the 1403), or the data you are trying to put in (for the 2291).
    John

  • Want To Pick a single file from the Source Directory

    Hi,
       My Scenario is File to Proxy. Legacy team is generating Bunch of files in a same directory.But i  want to pick single file for each poll interval. after process teh firts file only Sender Adapter should pick and process the next file .
    At prsent  , My scenario is picking all the files  in a single shot and all the files are processing parellelly. . But all the files are related to one Process Order So, out of bunch of files some few of files are processing successfullu. remaining all teh files are getting  " Proces Order is locked by another User" Error message . This was happeing only for the parellel processing.  And from technical point of view , In sender Communication Channel i have used  Quality of Service  is Exactly Once in Order  and i have mentioned the Queue name also. .
    Evel legacy team is generating Bulk of files i want to pick a single file only, suppose if theer is no chnace then at least i want to process single file at a time  after finishing the one file processing , then only i want to go for the next file
    For this, is teher any paremeters need to be set , please suggest me,.
    Regards
    Jain

    At prsent , My scenario is picking all the files in a single shot and all the files are processing parellelly.
    Are you using the Additional Source Files options?
    What you can do :
    1) Select Processing Tab > Processing Sequence> By Date
    2) You can introduce a delay between two processing by using a Thread.sleep(msec) statement in some UDF in your mapping...this will ensure some delay between two processing: Re: Delay in MM possible ?
    3) You can select the Connect Mode option as Per File Transfer.....keep it as the last option....
    Regards,
    Abhishek.

  • Picking not done error

    Dear All,
    After creating sales order and delivery document, while making warehouse transfer order it is showing
    "Picking is not done" error.
    In the delivery document delivery quantity is displaying and picking quantity showing 0 and the field is
    freezed but stock is available for the item.
    Please help me.
    Regds
    CG Balaji

    Dear Balaji,
                  As per your thread message I came to know that your delivery is linled with wearhouse management so you can't pick the goods manually you need to create transfer order to pick the goods.
    To create Transfer order fallow this process
    >Go to VL02N transaction enter the delivery number which you want to pick go in to that then select menu> Susequent functions-->Create transfer order
    or
    -->Go to LT03 transaction enter the wear house no. and delivery document no.then create the transfer order
    -->After completing the creation of the transfer order do the PGI to that delivery then billing.
    I hope it will help you
    Regards,
    Murali.

  • How to fix iPhone 3G "Random Error 1645".

    I kept getting the "Unknown 1645" error. iTunes wouldn't let me update/restore my iPhone. Until I came across this, which worked and now my iPhone is fully operational again. I hope others who are experiencing this "Random Error 1645" come across this thread.
    1. Disconnect your iPhone cable but leave connected the other USB end to the computer.
    2. Turn off your iPhone holding the Sleep/Wake button. The red slider bar appears. Slide the bar and wait until the iPhone turns off. Or you could hold the Sleep/Wake and Home buttons at the same time until the iPhone turns off.
    3. While pressing and holding the Home button connect the USB cable to your iPhone. It should power on. Hold the Home button until you see the "Connect to iTunes" message. Open iTunes if necessary. You should see the "iTunes detected an iPhone in recovery mode..." alert screen.
    4. Choose "Restore".
    Thanks.

    The iPhone is not user servicable. You can go to http://www.ifixit.com and get some instruction on how to try if if you want. Given that the 3G has been discontinued for 2 1/2 years, and there isn't much market for it any more, it might be worth your while.
    There is no magic that can fix broken hardware.
    You can get it replaced by Apple for $149, but at this stage, I think a newer phone would be a better investment.

  • I want to pick up Schedule line Delivery date based on Sales Order of Mater

    Hi Experts,
    I have one scenario like,
    I want to pick up Schedule line Delivery date based on Sales Order of Material.
    For example :
    Go to va03
    Give the order no
    Press the enter
    Double click on material.
    Go to Schedule line Tab
    Then we can find out the Delivery date .
    I want to pick up the that Delivery date. Could you please help on that.
    Thanks,
    Amjad.

    Hi,
    schedule line dates are available in VBEP.
    VBEP-VBELN = sales order number.
    VBEP-EDATU = schedule line date.
    REgards,
    Raghavendra

  • IPHONE 5: can't receive calls & random error messages, such as "could not activate cellular data network" and "no connection - network unavailable, please connect to wifi or cellular network."  This occurs even when signal strength or wifi is operational.

    IPHONE 5:  can't receive calls and random error messages, such as "could not activate cellular data network" and "no connection - network unavailable, please connect to wifi or cellular network."  This occurs even when signal strength or wifi is operational, and it does not matter whether wifi is on or off.  ATT went through the standard protocol - resetting network, resetting sim card, etc.  No changes.  Other phones working fine in same region with same carrier.  Apple's solution is to restore software, but haven't gone there yet.  Anyone successfully addressed this/these issues?   

    I should point out that it worked when the iPhone was set back to factory settings, but when restored with the backup, data/internet no longer works again, and I get the "Could not activate cellular data network" error message yet again.

  • If I'm reading a book on the iPhone and I want to pick up where I left off on my iPad, do I have to search for what page I was on on the iPad or is there a way to sync it?

    If I'm reading a book on the iPhone and I want to pick up where I left off on my iPad, do I have to search for what page I was on on the iPad or is there a way to sync it? Or do I just have to search for a string of text from my iPhone on my iPad?

    On both devices go to Settings>iBooks>Sync Bookmarks>On. Then when you want to quit reading on one device, tap the bookmark in the upper right corner and it will turn red. That marks your place. Close the book on the device now by tapping on the Library button in the upper left corner of the app. That will put the closed book back on the shelf. Tap the home button.
    On the other device, when you tap on the book, it should open to that page. You have to be connected to WiFi in order for this to work. You can read this older discussion for more information. I was involved in that as well.
    https://discussions.apple.com/thread/3754714?start=0&tstart=0

  • From  date column I want to pick the hours only......

    Dear All
    I am facing the following problem.
    I having following date format in database of date column
    4/7/2006 10:26 AM
    4/7/2006 07:18 PM
    from this date column I want to pick the hours only , For ex. 10, 07 resp.from the above record.
    I tried it to solve using SUBSTR and LTRIM-TRIM function, but this functions will truncate the time format and so unable to pick the Hours.
    Is there any other solution for this.
    Also the date column I have is in 12 Hours(AM/PM) format I want to convert it into 24 Hours . Like 07 PM . I want it to 19.
    Thanks
    Vishal.

    TEST@db102 SQL> select * from test;
    C1
    4/7/2006 10:26 AM
    4/7/2006 07:18 PM
    TEST@db102 SQL> select to_char(to_date(c1,'dd/mm/yyyy hh:mi PM'),'hh24') from test;
    TO
    10
    19
    TEST@db102 SQL>                                               

  • I want to pick upast two digit from variable

    Hi all there
    I want to pick up last two digit from a varibale whcih containt 3 digit value.
    Regards
    Sagar

    hi this is a bit good ...
    report ztest.
    parameters: v_test type p decimals 3.
    data: v_char type char18,
          str_len type i.
    v_char = v_test.
    str_len = strlen( v_char ).
    str_len = str_len - 2.
    write:/ v_char+str_len(2).

  • I want to Pick Release in 11.5.9 through API , What API I can Used?

    Hi.expert
    I want to Pick Release through API in 11.5.9, What API I can Used?

    You need to apply patch 3438823 which provides the Pick Release Public API to create and release a picking batch and also provides the functionality to allow picking criteria of groups of items based on Item category and category sets and also provision is provided to "exclude/include only" ShipSets/SMCs in a batch.
    Check Note: 435444.1 - WSH_PICKING_BATCHES_PUB Package for Pick Release Public API does not Exist in Release 11.5.9
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=435444.1

  • I WANT TO PICK UP RFQ DATE ( REQUEST FOR QUATATION )  ?

    I WANT TO PICK UP RFQ DATE ( REQUEST FOR QUATATION ) .
    please tell me how to find RFQ Creation date.
    i used RM06E-ANFDT .
    but RM06E is the structure .
    i want the table name from which i can find RFQ DATE .
    PLEASE HELP ME.

    Hi Sandeep,
    try vbak...
    Regards,
    Kaveri

  • C++ application with pro*c generating random errors

    Hi there,
    As described, I have a C++ application with a pro*c module to access the DB. The problem is that it produces random errors.
    Randomly, it fails executing a query, but other times it fails in other modules, or just opening a cursor. I list you two examples of queries that fail:
    ================================================================
    CHECK_CONNECTED
    EXEC SQL BEGIN DECLARE SECTION;
    long Id_db;
    long startValidityMicroseconds_db;
    long stopValidityMicroseconds_db;
    VARCHAR name_db [LEN_NAME + 1];
    VARCHAR creationDate_db [LEN_DATE + 1];
    VARCHAR startValidityDate_db [LEN_DATE + 7 + 1];
    VARCHAR stopValidityDate_db [LEN_DATE + 7 + 1];
    short name_db_ind;
    EXEC SQL END DECLARE SECTION;
    // Set the key
    Id_db = Id
    EXEC SQL SELECT NAME,
                             TO_CHAR(CREATION_DATE, :DATE_FORMAT),
                             TO_CHAR(START_VALIDITY_DATE, :DATE_FORMAT),
                             TO_CHAR(STOP_VALIDITY_DATE, :DATE_FORMAT),
                             NVL (START_VALIDITY_MICROSECONDS ,0),
                             NVL (STOP_VALIDITY_MICROSECONDS ,0),
    INTO :name_db :name_db_ind,
         :creationDate_db,
         :startValidityDate_db,
         :stopValidityDate_db,
         :startValidityMicroseconds_db,
         :stopValidityMicroseconds_db,
    FROM ROP_TB
    WHERE ID = :Id_db;
    ================================================================
    ================================================================
    CHECK_CONNECTED
    EXEC SQL BEGIN DECLARE SECTION;
         long objectId_db;
         VARCHAR objectName_db [LEN_OBJECT_NAME + 1];
    EXEC SQL END DECLARE SECTION;
    strncpy ((char *) objectName_db.arr, object_db.c_str (), LEN_OBJECT_NAME);
    objectName_db.len = object_db.length ();
    EXEC SQL DECLARE CU_OBJECT_TB CURSOR FOR
    SELECT OBJECT_ID INTO :objectId_db
    FROM OBJECT_TB
    WHERE OBJECT_NAME = :objectName_db;
    EXEC SQL OPEN CU_OBJECT_TB;
    ================================================================
    It keeps failing randomly and I don't know really know what my eyes are missing. Sometimes I get a "simple" seg fault because a query returned invalid values and my application crashes, other times I get oracle errors.
    I really hope someone could help me here :)
    Kind regards!

    Well, random because it is not always the same nor the error code.
    - Sometimes I get segmentation fault on "sqlcxt";
    - "ORA-01024: invalid datatype in OCI call" on queries that usually work
    - "ORA-03114: not connected to ORACLE" on queries that usually work
    I have run valgrind and the only "place" where there could be an issue is reported to be caused by oracle libs:
    ==27055== 8,214 bytes in 1 blocks are possibly lost in loss record 193 of 206
    ==27055== at 0x40046FF: calloc (vg_replace_malloc.c:279)
    ==27055== by 0x43E2975: nsbal (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42F04E6: nsiorini (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x4300FD2: nsopenalloc_nsntx (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42FFD73: nsopenmplx (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42F91FD: nsopen (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42BDAFE: nscall1 (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42BB0D7: nscall (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x435F653: niotns (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x43F9E40: nigcall (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x436AD4B: osncon (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x41EAA31: kpuadef (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)

  • Want to pick old files first (First In First Out  mode)

    Hi,
      My scenario is File to Idoc Scenario getting multiple  files in batch mode  into  source FTP server. But  i want to pick which file has first loaded into ftp server that particular file only i want to process first.
    my source file name doesn't contain any Timestamp value . but by considering the FTP server timings we  have to pick the file.
    From the source I'm getting files like ( Jain_1.xml , Jain_2.xml ,Jain_3.xml.... ect...) so in my sender adapater i have mentioned that file name as Jain.xml*
    For picking earliest file suggest me some solution.
    for this how can achive this. and what are the things we have to do. 
    Regards
    Jain

    Hi Jain,
    I havent exactly tried doing this one. I used file*.txt once but i didn't need it to pick in any order. My scenario had to pick all the files...
    but i found this for you.....
    File Adapter , Processing Sequence
    EDIT :
    picking files in Order?
    Read the above link Jain. File adapter does not give a processing sequence for FTP protocol.
    But it reads files in alphabetical order. So you have 2 choices.
    1> Either use NFS to run your scenarios
    2> Else rename your files to Jain_a.xml, Jain_b.xml, Jain_c.xml. This way they will be in alphabetical order and hence will be picked in the order you want.
    If you want to rename your files dynamically at runtime. Look at the variable substitution concept.
    That can be found here...
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
    To learn more about it...just search with the string variable substitution in the forums and you will find answers.
    Best Regards,
    Kshitij
    Edited by: Kshitij Sharma on Feb 3, 2009 9:12 AM

Maybe you are looking for