Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ABout my proggie fo school

Name: Mike 2007-09-23 15:42 ID:B86NjxXZ

hey guys, could you help me a bit? i have to write program for school, with percent numbers

my code is:

[java]public static void main(String[] MIKESPROGRAM){
     int WHITEMARBLENUMBER=5,BLACKMARBLENUMBER=4;
      int NUMBEROFMARBLES=WHITEMARBLENUMBER+BLACKMARBLENUMBER;
    //prints out percentage of black marbles:
System.out.println("Percentage of white marbles: " + WHITEMARBLENUMBER%NUMBEROFMARBLES);
[/jva]

why dont it print percentage of marbles? it says 5???

Name: Anonymous 2007-09-23 19:37 ID:zhLHo3l4


public static void main(String[] MikesProgram){
   int whiteMarbleCount = 5,
       BlackMarbleCount = 4;
   int totalMarbleConut = whiteMarbleCount + BlackMarbleCount;
  
   System.out.println("Percentage of white marbles: "
                     + whiteMarbleCount/(100.0*totalMarbleConut))
}


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List