Welcome to the Treehouse Community
Looking to learn something new?
How to output a number raised to the power in Java
Hello, I'm finishing up this application I am writing that displaced the cubic feet of boxes. However it's just printing 355ft. I need it to print 355ft^3 BUT NOT THE "^" SYMBOL. The three needs to be smaller too, since it's cubic feet. Any ideas?
Michael DavisCourses Plus Student 12,508 Points
It sounds like, to me, that you are trying to get the 3, representing "cubed", to show as superscript. Displaying text in the superscript or subscript is a formatting task, and as such would require some sort of text manipulation. If your result is going to be displayed in HTML, you can use the <sup></sup> tag to cause it to display in the
As an alternative, you can have the text display as
355 cu-ft, or if you really want the superscript 3, use the unicode representation
'\u00B3'. If you open your browser's web console and type '\u00B3', including the quotes, you'll get the superscript 3.
I'm not 100% sure how, but at least in Python you can use the double asterisk, like this: **