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 2 of 2

Thread: can someone please make this code

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default can someone please make this code

    Your class should be called Number. It should contain 6 fields of type int
    named correspondingly for numberEntered, firstDigit, secondDigit, thirdDigit,
    fourthDigit and fifthDigit. You should have the following methods:
    a) default constructor – initializes to "no data" ie zeros.
    b) getNumberFromUser – prompts user for the five-digit number and reads in
    their input
    c) calculateDigits – calculates each of the five digits
    d) displayDigits – displays each of the digits on a separate line
    Rewrite your main method to declare a reference variable to an object of this
    class, use new to create (instantiate) the object, and then call the methods
    on the object.

    Im new to Java and still dont get this.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: can someone please make this code

    What have you tried so far? If you're not sure where to start, start by working from the top down:

    1. How do you declare a class? What should it be called?

    2. What methods do you need? Do you know the parameters? What should the method return?

    3. What fields do you need?

    4. What should method 1 do?

    5. What should method 2 do?


    ... etc.

Similar Threads

  1. I NEED HELP, HOW TO MAKE THIS CODE!!!
    By tahsim in forum Member Introductions
    Replies: 1
    Last Post: March 20th, 2012, 09:05 AM
  2. How to make this code even simpler
    By blakmaze in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 30th, 2011, 03:00 PM
  3. How to make code more efficient?
    By Apocalypse in forum Java Theory & Questions
    Replies: 2
    Last Post: October 21st, 2011, 09:07 AM
  4. need help to make my code flexible.
    By sagar474 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 29th, 2011, 12:11 PM
  5. Make my code follow MVC
    By alpvii in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 29th, 2010, 07:48 AM