Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Do I Format Text?

 
P. Larson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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 !!
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What sort of formatting code have you got already?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12124
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "assignment 5"? Where is this assignment from?
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do Cattle Drive assignments use a particular version of Java?
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic