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: Learning about formatting your output

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Learning about formatting your output

    This program should be an example of how Java lets you format numbers and strings. First you will need to study Java's formatting facilities, and then write a program which shows real numbers being printed with different widths and precisions. Show how the result of printing 8/3 [eight divided by three] can be printed in different ways (different widths and different precisions). Show how we can left-justify a column of several rows of names, and how we can right -justify them. Show how we can make a column of decimal numbers line up on their decimal points. You have a lot of latitude in this program and can be creative. Experiment. A good program will show that its creator has studied and understood all the ways that data can be formatted when printed.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,143
    Thanks
    48
    Thanked 2,157 Times in 2,130 Posts

    Default Re: Learning about formatting your output

    Do you have a question?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jan 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Learning about formatting your output

    my question is that i didn't understand the question i just posted.

  4. #4
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    939
    Thanks
    6
    Thanked 202 Times in 178 Posts

    Default Re: Learning about formatting your output

    It wasn't a question. It was mostly a list of things you were told to do.

    Don't be put off by the detail - alignment, precision etc - the most important thing you were told to do is "study Java's formatting facilities". If you have a textbook, consult it. Certainly read the API documentation.

    What class or classes are you going to try using? Once you have that sorted out you can begin thinking about each of the formatting styles you were asked to illustrate.

    [Edit] And post if you get stuck! As you've realised, nobody here is going to write the code for you (and you haven't asked for that). So it is really important you say precisely what you are going to do (what classes) and where you're at (what code) And ask questions that are as specific as possible (What does "alignment" mean?, What does the following runtime exception mean? etc)

Similar Threads

  1. Formatting 2d Array Output
    By dspear in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: December 14th, 2011, 05:45 PM
  2. Formatting Output
    By mael331 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: September 14th, 2011, 06:41 PM
  3. Question about formatting output
    By mwr76 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 10th, 2011, 11:57 AM
  4. Formatting output of a Double
    By CarlMartin10 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 11th, 2010, 04:20 PM
  5. Replies: 3
    Last Post: August 19th, 2009, 11:30 AM