compile error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: compile error

  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unhappy compile error

    I am trying to write a program that simulates the roll of 3 dice 60000 times add the face values, detrmines their frequency and express it in percentages. When trying to compile I grt an error message that says modifyArray(int) in lab5 cannot be applied to modifyArray(); .Please help I do not understand the message
    Thank you
    Nancy
    Here is my code

    // Applet that simulates rolling of 3 dice, sum the faces, display the frequency in percentages and total both the
    // frequency and the percentages

    import javax.swing.*;
    import java.awt.*;
    import java.awt.Container;
    public class Lab5 extends JApplet {

    JTextArea outputArea;
    int face,frequency[] = new int[ 19 ];
    String output= "";
    double percent = 0.00;

    public void init() {
    outputArea = new JTextArea();
    Container c = getContentPane();
    c.add (outputArea);
    outputArea.setFont(new Font("Courier", Font.ITALIC, 18));

    showArray();
    modifyArray();
    }
    public int rollDice() {
    int die1, die2, die3;

    //roll dice 60000 times
    for ( int roll= 1; roll <= 60000; roll++) {
    die1 = 1 +(int) ( Math.random() * 6 );
    die2 = 1 +(int) ( Math.random() * 6 );
    die3 = 1 +(int) ( Math.random() * 6 );

    face = die1+die2+die3;
    }
    // use face value as subscript for frequency array
    ++frequency[ face ];
    return face;
    }

    public void showArray() {
    // append frequency to String output
    for (face=3; face < frequency.length; face++ ){
    output +="\n" + face + "\t" + frequency[face]+ "\t\t" + percent;

    outputArea.setText("Sum\tFrequency\t%"+"\n" + output );//+ "\n\n" + "Total");
    }
    }

    public void modifyArray(int frequency) {
    percent = frequency/600;


    }


    }

  2. #2
    Join Date
    Mar 2004
    Posts
    5
    I got it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center