User Profile

Collapse

Profile Sidebar

Collapse
TheHav
TheHav
Last Activity: Dec 29 '08, 12:08 AM
Joined: Oct 4 '08
Location: NY
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • TheHav
    replied to How Can I??
    in Java
    Thanks I didnt think of that
    See more | Go to post

    Leave a comment:


  • TheHav
    replied to How Can I??
    in Java
    For Ex if roll2Dice( ) feeds back a 3, I want to add 1 this to the "appropriat e element of the array with out using an if statement."

    If you want to look at the code i have so far
    Code:
    public class Dice {
        public static void main(String[] args) {
            int[] count = new int[13];
            int roll = 1;
            while (roll <= 3600) {
                int i = roll2Dice();
    ...
    See more | Go to post

    Leave a comment:


  • TheHav
    started a topic How Can I??
    in Java

    How Can I??

    How Can i do this with out using an if statement?
    Hint please

    Code:
    while (roll <= 3600) {
       int i = roll2Dice();
       if (i == 3) count[3] = count[3] + 1;
       if (i == 5) count[5] = count[5] + 1;
       if (i == 7) count[7] = count[7] + 1;
       if (i == 9) count[9] = count[9] + 1;
       if (i == 11) count[11] = count[11] + 1;
       roll = roll + 1;
    }
    See more | Go to post

  • TheHav
    started a topic Help please
    in Java

    Help please

    I was writing a simple programs on arrays and i dont know why these error pop up if some can explain what im doing wrong

    public class CoinValues {
    public static void main(String[] args) {
    int[] coinValue = {5,10,25};
    String[] coinWord = {"nickels","dim es","quarters"} ;

    int count = IB.inputInt("Ho w many coins do you have? ");
    int i = IB.inputInt("En ter...
    See more | Go to post
No activity results to display
Show More
Working...