• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How Do I Format Text?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to do assignment 5, where you make a times table chart. Can anyone please give me a better example of format text? Because this is my first time ever trying to do format text. Thank You !!
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What sort of formatting code have you got already?
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "assignment 5"? Where is this assignment from?
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The idea with the formatting here is just to make the columns of the times table line up by putting a number of spaces between each entry. There are a number of possible ways to make that happen, so it's up to you to find one that works. Have you been able to output the table at all yet?

Also, you should post questions about Cattle Drive assignments in the Cattle Drive forum. You're welcome to ask questions about the the underlying Java code in Beginning Java, but you'll have to frame the question that way. Referencing "Assignment 5" in any other forum likely won't make sense to anyone there.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do Cattle Drive assignments use a particular version of Java?
 
Greg Charles
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They were created for Java 1.4. I'm in the process of updating the Servlet assignments to Java 7, and I believe Katrina is working on updating the earlier assignments. I'm not sure how far along she is though.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anybody know where there are archives of the old version of the Java Tutorials? The up to date Java tutorials have two sections which may be relevant: 1 2. But the %d tags were not available in JDK1.4, so you end up having to use a NumberFormat instance, probably a DecimalFormat instance. You should find an example in one of those tutorial links, I think No 1. It should be easy enough to work out a pattern of ### for whole numbers.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic