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

Thread: programming assignment

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default programming assignment

    Hi
    I have this assignment to do. Input ten words into and output them backwards, include there in a for loop. Can anyone please help?


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,316
    My Mood
    Mellow
    Thanks
    194
    Thanked 671 Times in 658 Posts

    Default Re: programming assignment

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Show what you've done so far, posted correctly per the above link, and ask any specific questions you have. We can't do it for you.

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: programming assignment

    import java.io.*;
    import javax.swing.*;


    public class SkrivaOrd {

    public static TioOrd {
    String s = JOptionPane.showInputDialog("Input ten words ");
    for (int i=s.length()-1; i>=0; i--)
    s = s + s.charAt(i);
    return r;
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {

    }

    }
    I have done this so far. Im struggling with this.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,316
    My Mood
    Mellow
    Thanks
    194
    Thanked 671 Times in 658 Posts

    Default Re: programming assignment

    Please post your code using code or highlight tags as explained near the top of this topic.

    Think through the assignment and match the requirements to what a program needs to do, then put that into a rough outline based on what you know or should know in Java. For example:

    1. Input ten words: How is that done? Since it's a repeated activity, a loop might be useful. Where will the values be stored? In an array or other collection? In 10 different variables? How will the user input be retrieved? Check out the Scanner class.

    2. output them backwards: How is data output to the console? Again, a repeated activity, so a loop should be helpful. Since the data is output backwards, all 10 items of data must be collected before they can be output.

    3. include a for loop: Suggested in #1 and #2.

Similar Threads

  1. Java Programming (Object Oriented Programming) Assignment
    By azmilPhenom in forum Object Oriented Programming
    Replies: 3
    Last Post: December 21st, 2013, 06:26 AM
  2. [SOLVED] Java Help
    By solidMGSsnake in forum What's Wrong With My Code?
    Replies: 26
    Last Post: December 10th, 2013, 04:59 AM
  3. Help with programming assignment! New!
    By thejewishpriest in forum Member Introductions
    Replies: 1
    Last Post: April 15th, 2013, 03:30 AM
  4. Help on programming assignment
    By aaronmcohen in forum AWT / Java Swing
    Replies: 0
    Last Post: March 7th, 2012, 06:47 PM
  5. programming assignment help
    By sdgseed in forum Threads
    Replies: 1
    Last Post: October 20th, 2010, 02:43 PM