Results 1 to 4 of 4
  1. #1
    zypchun is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default why i can not compile? please help

    public class project4aczhang34
    {

    public static void main (String[] args)
    {
    String fname = FileChooser.pickAFile();
    Sound s = new Sound (fname);

    System.out.println ("Number of samples in the sound: " + s.getLength());
    System.out.println ("Number of samples per second: " + s.getSamplingRate());

    double lengthInSeconds = s.getLength() / s.getSamplingRate();

    System.out.println ("The length in seconds of the sound: " + lengthInSeconds);

    String input;
    input = SimpleInput.getString ("Please type the message you want to encode into the your sound file:");
    System.out.println(input);

    int digit1, digit2, digit3;
    int temp;
    //int array[ ] = new int[100];
    int array[ ]= new int[input.length()*3];


    for (int i=0; i<input.length(); i++)
    {
    char ch = input.charAt(i);
    int asciiNum = (int) ch;
    System.out.println ("For Character:" + ch + "int ascii value is;" + asciiNum);

    digit1=asciiNum % 10;
    temp = asciiNum /10;
    digit2 = temp %10;
    temp = temp /10;
    digit3 = temp%10;
    System.out.println ("The digits are:" + digit1 + "," + digit2 + "," +digit3);

    array [i*3+0]=digit1;
    array [i*3+1]=digit2;
    array [i*3+2]=digit3;
    Sound NewSound = codesound(s,array);
    NewSound.explore();
    }


    public static Sound codesound (Sound s, int [ ])
    {
    SoundSample sampArr [ ]= s.getSamples();
    SoundSample samp;

    int numberOfSamples = s.getLength();

    Sound s1= new Sound (numberOfSamples);
    SoundSample sampArr1 [ ] = s1.getSamples();
    SoundSample samp1;

    int index;
    int sampVal, sampVal1;

    for (index =0; index <sampArr1.length; index ++)
    {
    samp = sampArr [index];
    samp1 = sampArr1 [index];

    sampVal = samp.getValue();

    int digit4;
    digit4 = sampVal % 10;
    int modAmpValue;
    modAmpValue = sampVal - digit4;

    if (sampVal >=0)
    sampVal1 = modAmpValue + array[index];
    else
    sampVal1 = modAmpValue - array[index];

    if (sampVal >32767)
    sampVal1 =sampVal1-10;
    else if (sampVal <-32767)
    sampVal1 =sampVal1+10;
    else
    sampVal1= sampVal1;
    samp1.setValue (sampVal1);
    return s1;
    }

    }
    }
    }

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    11,605
    Blog Entries
    7
    Rep Power
    17

    Default

    1) Is your computer plugged in the AC?
    2) Do you have the JDK installed?
    3) No path issues?
    4) Did a fuse blow? (see 1)
    5) etc.

    kind regards,

    Jos
    When people rob a bank they get a penalty; when banks rob people they get a bonus.

  3. #3
    jojo is offline Member
    Join Date
    Dec 2009
    Posts
    36
    Rep Power
    0

    Default

    i think you miss a {or }
    anyways use code tags and post the error you get

  4. #4
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    3

    Default

    where are your imports?

    where are the FileChooser and Sound classes?

Similar Threads

  1. would this compile?
    By stringkilla in forum New To Java
    Replies: 10
    Last Post: 10-24-2010, 03:27 PM
  2. Can't Compile
    By sidk47 in forum JavaServer Pages (JSP) and JSTL
    Replies: 7
    Last Post: 06-15-2010, 04:43 PM
  3. Help with compile
    By mr_anderson in forum NetBeans
    Replies: 7
    Last Post: 06-10-2010, 04:03 AM
  4. doesn't compile?!
    By jon80 in forum New To Java
    Replies: 8
    Last Post: 06-14-2008, 05:42 PM
  5. Not able to compile
    By bugger in forum New To Java
    Replies: 2
    Last Post: 01-09-2008, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •