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: Write A Java Program to store values (Beginner)

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Write A Java Program to store values (Beginner)

    Hi guys.

    First of all, Im a new beginner in Java programming. Anyone can help me regarding this problem?

    An array nums stores the following values in the range of 1-5:



    Write a Java program to store the above values in the array. Then, the following output will be produced by the program. Your program must use loop and selection structure such as if-else.

    1: 0
    2: 1
    3: 2
    4: 3
    5: 1

    [Explanation about the output: There are no 1's in the array nums, there is one 2, there are two 3's, there are three 4's, and there is one 5]


    Please help me and your fast help really means a lot

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Write A Java Program to store values (Beginner)

    What have you tried?

    Be sure to wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Nov 2019
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Write A Java Program to store values (Beginner)

    I didnt even know how to start . Im totally blur about this. Can you give me the basic and explain to me sir?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Write A Java Program to store values (Beginner)

    First step is to make a list of the steps the program needs to take to solve the problem.

    Things to consider:
    where does the program get the numbers to be stored
    what should be done with the numbers as they are received
    what should the program do while it is getting the numbers
    what should the program do after it has gotten all the numbers

    I'm not sure I understand what the program is supposed to do.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Nov 2019
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Write A Java Program to store values (Beginner)

    An array nums stores the following values in the range of 1-5:

    subscript 0 1 2 3 4 5 6
    value 2 3 4 5 4 4 3

    Write a Java program to store the above values in the array. Then, the following output will be produced by the program. Your program must use loop and selection structure such as if-else.

    1: 0
    2: 1
    3: 2
    4: 3
    5: 1

    im forget to put the table above.
    Last edited by blackredblink; November 16th, 2019 at 09:44 PM.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Write A Java Program to store values (Beginner)

    Ok, have you tried making the list of steps the program needs to take to solve the problem? You will need that before trying to write any code.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: December 1st, 2018, 03:39 PM
  2. Replies: 3
    Last Post: September 30th, 2014, 09:29 AM
  3. Replies: 2
    Last Post: April 5th, 2014, 11:05 AM
  4. Replies: 7
    Last Post: May 28th, 2013, 09:03 AM
  5. [SOLVED] Java Beginner: Help with methods and returning values (hailstone program)
    By alf in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 14th, 2010, 06:28 PM