Results 1 to 9 of 9
  1. #1
    Prokopyo is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default Please help me with this problem

    Question Number 1

    Write a java application that display and sums up all the even numbers from 1-20.

    Sample Output:
    Even numbers are
    2 4 6 8 10 12 14 16 18 20 = the sum of all numbers is 110


    Question Number 2

    Using while loop display the multiplication table.

    1 2 3 4 - 10
    2 4 6 8 - 20
    10 20 30 40 - 100


    Please help me !
    I really need an answer as soon as possible !

    Thanks :)

  2. #2
    Join Date
    Mar 2011
    Posts
    94
    Rep Power
    0

    Default

    Have you attempted to work this out on your own? Are you stuck on a particular concept or do you have no idea where to start?

  3. #3
    Prokopyo is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default

    I just don't know how to WRITE this JAVA APPLICATION.

    Its my assignment in school then i did absent for one day.
    Then my instructor give me that ASSIGNMENT . :(

    Please help!

  4. #4
    Prokopyo is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default

    can you give me a sample sir!

    in using JAVA NETBEANS!

  5. #5
    Join Date
    Mar 2011
    Posts
    94
    Rep Power
    0

    Default

    The thing is, we're not here to do your homework. I suggest you do the following:

    1. Read your textbook and try to create a very simple Java program. There may even be a simple "Hello World" program for you to try.
    2. In that program, you will probably have a main() method. You can add your own code to that main() method. That's where you can add your statements.
    3. For Question 1, you can use a for loop to iterate through all of the numbers from 1-20. To determine if a number is even, use the modulus(%) operator. For example 8 % 2 will return 0. That means 8 is an even number.
    4. Once you have determined that a number is even, add it to your running total.
    5. When the for loop ends, display your running total.

    After you get through Question 1, you will be better prepared to tackle Question 2.

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Lets not spoonfeed him such simple code.

    @op: we try not to give you code, you won't learn that way.

    This is pretty easy(and logical)

    Just google how loops work and then think how you would do this by hand and you can easily figure it out.

  7. #7
    Prokopyo is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default

    Please sir !

    Help me! i really need it now :)

    next time i'll google for it!

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Quote Originally Posted by Prokopyo View Post
    Please sir !

    Help me! i really need it now :)

    next time i'll google for it!
    You have been told.
    This is not a code factory.

  9. #9
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    No, I will not give you this code, this will take you maybe 5 minutes of thinking.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •