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: Wave Numbers

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

    Default Wave Numbers

    Hello Every one,

    I need some help with my code. I need an output that looks something like this
    ----------------------------------------
    _-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-
    1122334455667788990011223344556677889900
    ----------------------------------------

    The problem I am having is with the line on top of the numbers of 1, 3,5, 7, 9.
    My code has to much of space in between the spike symbols and numbers so it looks like this

    ----------------------------------------
    -^- -^- -^- -^- -^- -^- -^- -^- -^- -^-
    _ __ __ __ __ __ __ __ __ _
    1122334455667788990011223344556677889900


    for (int a =1; a<=40; a++)
          System.out.print("-");
     System.out.println();
    for (int b=1; b<=10; b++)
         System.out.print("-^-");
    System.out.println();
    for (int c=1; c<=9; c++)
         System.out.print("_   _");
     System.out.println();
    for(int r =1;r<=2; r++)
    {
      for (int d=1; d<=9; d++)
      {
       for(int i=1; i<=2;i++)
    System.out.print(d);
    }
    System.out.print("00");
    }


  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: Wave Numbers

    Are you asking about the font sizes of various characters so that they will be in column?
    A monospace font gives all the characters the same size so they can be lined up.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Wave Numbers

    No I was looking at the spacing. My code had to much of a gap in it. So I what I did to fix this was to put a ("_-^-") on my System.out. print("-^-"). That fix my gap.

  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: Wave Numbers

    That was an easy fix. Glad you got it working.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Radio Wave transmission
    By KAJLogic in forum The Cafe
    Replies: 1
    Last Post: August 21st, 2014, 03:02 AM
  2. Reading Every sample of a Wave audio file Using Java
    By cserge in forum Member Introductions
    Replies: 1
    Last Post: May 9th, 2014, 04:25 AM
  3. UnsupportedAudioFileException opening a 3 or more channels wave file
    By Revenge in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: November 25th, 2013, 12:10 PM
  4. What programs/programming language can I use to draw & animate a wave?
    By Atypically Engineered in forum Totally Off Topic
    Replies: 1
    Last Post: July 30th, 2013, 08:28 AM
  5. Creating a Triagular Wave in Java
    By locorecto in forum AWT / Java Swing
    Replies: 3
    Last Post: March 8th, 2010, 01:51 AM