Help! New to java!

Discussion in 'General Computer Support' started by cluemein1, Oct 11, 2010.

  1. cluemein1

    cluemein1

    Joined:
    Oct 11, 2010
    Messages:
    1
    So, I'm supposed to create a program that will loop around the number of times a user chooses and within each loop a user is supposed to input a last and first name and they're supposed to output aligned with each other like this.

    Input first name: Sue
    Input last name: Smith
    ____________________First name: Sue_____Last name: Smith

    and I need another loop within my loop to apparently help each outputted set of names stayed lined up with each other, by creating a 15 character blank till it starts with the last name regardless of how long your first name was.
    Yeah I have no idea what I'm doing, but here's the code I popped out of my ass so if anyone can help me out, it'd be very much appreciated.

    import java.util.Scanner;
    public class Lab4aCO4
    {
    public static Scanner scan= new Scanner (System.in);
    public static int count;
    public static name;




    //////////////////////////////////////////////////////////////////
    // Purpose:
    //////////////////////////////////////////////////////////////////
    public static void main(String[] args)
    {System.out.println("How many names do you want to output? " +count);
    scan.nextLine();

    int count= 0;
    while(count > 0)


    name=0;
    while(name.length() <15)
    {
    name=name + " ";
    System.out.println("Input a first name: ");
    scan.nextLine();
    name=name +1;
    }
    System.out.println("Input a last name: ");
    scan.nextLine();

    count=count+1;
    }
    }
    Last edited: Oct 11, 2010
    cluemein1, Oct 11, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Kohan

    JAVA VIRTUAL MUCHINE OR SUN JAVA

    Fernando Kohan, Nov 13, 2004, in forum: Firefox
    Replies:
    1
    Views:
    750
    Clark
    Nov 14, 2004
  2. dakine

    MS Java or Sun Java???

    dakine, Jul 20, 2004, in forum: Computer Support
    Replies:
    9
    Views:
    1,435
  3. emerald
    Replies:
    3
    Views:
    12,711
    The Modfather
    May 14, 2006
  4. chuck

    Firefox and Java - but no Java

    chuck, Mar 19, 2007, in forum: Firefox
    Replies:
    1
    Views:
    342
    Peter.Potamus.the.Purple.Hippo@gmail.com
    Mar 19, 2007
  5. -Dan-
    Replies:
    0
    Views:
    531
    -Dan-
    Aug 5, 2005
Loading...

Share This Page