GIDForums  

Go Back   GIDForums > Computer Programming Forums > Java Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Feb-2010, 18:19
d0ll3rb1ll d0ll3rb1ll is offline
New Member
 
Join Date: Nov 2009
Posts: 10
d0ll3rb1ll is on a distinguished road

[Answered] Printing a literal % sign


I know this is an easy answer but I'm having a brain fart. I just want to print a number and a percent sign in the code below example: Percentage grade for Exam #1: 67%

JAVA Code:
System.out.println("Percentage grade for Exam #1:" + Math.round(((double) (((aStudent.getExam1().getPointsEarned()/ ((double )aStudent.getExam1().getTotalPoints())))* 100.0))));
  #2  
Old 07-Feb-2010, 18:41
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Printing a literal % sign


Continue the string?

...("Percentage grade for Exam #1:" + theMath + "%");
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 07-Feb-2010, 18:52
d0ll3rb1ll d0ll3rb1ll is offline
New Member
 
Join Date: Nov 2009
Posts: 10
d0ll3rb1ll is on a distinguished road

Re: Printing a literal % sign


Thank you. I was just going + % and didn't have the quotations.
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing huge shelf layout VimaxV MS Visual C++ / MFC Forum 0 12-Jul-2007 08:39
MemberGenerator.com // Get Paid To Sign Up Site // Get Users On Your Website MemberGenerator Member Announcements, Advertisements & Offers 1 05-Feb-2007 16:51
Printing posters... blumagic Graphics Forum 0 03-Apr-2006 08:11
Printing problems--->ARG! toddm123 .NET Forum 0 31-Mar-2005 12:51
printing binary search tree nkhambal C Programming Language 2 26-Mar-2005 03:01

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:58.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.