Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Java question. Please help me!

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    7
    My Mood
    Amused
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Java question. Please help me!

    Write a program to create an array of integers of size 10. Then, the program should generate and insert random numbers between 1 and 50, inclusive into the array. Next, the program should print the array as output. Then, the program should generate another random number between 0 and 9, inclusive and print this value too. This number represents the position in the array (e.g. 0 represents the 1st position in the array). Then, shift the entire numbers one place to the right and insert 99 into this random position. Assume that the number in the right-most position of the original array will be lost during the shift. There is no user input for this program.

    Your program must include, at least, the following methods:

    • insertNumbers, which will take as input one integer array and store the random numbers in it.
    • generatePosition, which will generate and return the random position to be inserted into.

    A sample run of the program is shown below:

    Sample output #1:
    Array: 43 14 8 12 1 23 15 4 2 14
    Random position: 2
    Final Array: 43 14 99 8 12 1 23 15 4 2

    Please help me!


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Java question. Please help me!

    What have you tried? - Matt Gemmell

    Post your code and ask specific questions. We won't do your assignment for you.

  3. #3
    Member llowe29's Avatar
    Join Date
    Jul 2013
    Posts
    116
    My Mood
    Tired
    Thanks
    9
    Thanked 5 Times in 5 Posts

    Default Re: Java question. Please help me!

    try first, this is not the first time youve came looking for answers. You will never learn without trying.

  4. #4
    Junior Member
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Java question. Please help me!

    ...
    Last edited by copeg; August 2nd, 2013 at 12:25 PM. Reason: Removed spoonfeeding

  5. The Following User Says Thank You to elizabethyang For This Useful Post:

    phosphenes (August 3rd, 2013)

  6. #5
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Java question. Please help me!

    Do not post fully coded solutions. Why?
    1. The person does not learn from it.
    2. It is academic dishonesty (plagiarism) and they can be expelled from school or university.

    Please remove you code or mod will.
    Improving the world one idiot at a time!

  7. The Following User Says Thank You to Junky For This Useful Post:

    copeg (August 2nd, 2013)

  8. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java question. Please help me!

    @elizabethyang and phosphenes, please read
    http://www.javaprogrammingforums.com...n-feeding.html
    The code has been removed

Similar Threads

  1. Replies: 1
    Last Post: November 1st, 2012, 07:54 AM
  2. Challenging Java Question: Test your Java skill by grouping these terms
    By karthickk3 in forum Java Theory & Questions
    Replies: 3
    Last Post: July 18th, 2012, 10:10 PM
  3. Java EE Question
    By djl1990 in forum Java Theory & Questions
    Replies: 2
    Last Post: May 12th, 2012, 12:42 PM
  4. help for this java question
    By marlontoyo in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 20th, 2011, 08:09 PM
  5. Java Question
    By NiCKYmcd in forum Java Theory & Questions
    Replies: 1
    Last Post: August 25th, 2010, 08:47 AM