Simple Error Correction?

I am currently doing a very beginner Java programming project where I have drawn a penguin using two ovals and three triangles. I am now attempting to make the penguin move from left to right across the screen. The code that I am posting I feel should get the job done however I am receiving an <identifier> expected error for line 112
here is the line:
th.start();
I have searched for a solution to this and I realize it is a very standard and typical error. If anyone could help me through this it would be much appreciated as this is basically the last piece to my assignment. Thanks a lot.
import java.awt.*;
import java.applet.*;
public class Part5 implements runnable {
  private Location loc1;
  private Location loc2;
  private int ovalheight1;
  private int ovalwidth1;
  private Oval oval1;
  private Color colorblack;
  private Location offset;
  private Location loc3;
  private Location loc4;
  private int ovalheight2;
  private int ovalwidth2;
  private Oval oval2;
  private Color colorwhite;
  private Location offset1;
  private Location location;
  private Triangle triangle;
  private Location corner1;
  private Location corner2;
  private Location corner3;
  private Color colororange;
  private Location offset2;
  private Triangle triangle2;
  private Location offset3;
  private Triangle triangle3;
  private Location offset4;
  /* Initialize variables for the ovals */
  public void init() {
    //ovalblack
    loc1 = new Location(20, 0);   
    loc2 = new Location(50, 20);
    ovalheight1 = 250;
    ovalwidth1 = 350;
    colorblack = new Color(0, 0, 0);
    oval1 = new Oval(loc1, loc2, ovalheight1, ovalwidth1, colorblack);
    offset = new Location (50, 20);
    oval1.changeLocation (offset);
    //ovalwhite
    loc3 = new Location(80, 75);   
    loc4 = new Location(60, 40);
    ovalheight2 = 165;
    ovalwidth2 = 255;
    colorwhite = new Color(255, 255, 255);
    oval2 = new Oval(loc3, loc4, ovalheight2, ovalwidth2, colorwhite);
    offset1 = new Location (50, 42);
    oval2.changeLocation (offset1);
    //beak
    location = new Location (10,20);
    colororange = new Color (255, 128, 0);
    corner1 = new Location(0, 290);
    corner2 = new Location(100, 312);
    corner3 = new Location(0, 325);
    triangle = new Triangle(corner1, corner2,
    corner3, location, colororange);
    offset2 = new Location (220, -220);
    triangle.changeCorners (offset2);
    //left foot
    location = new Location (150, -225);
    colororange = new Color (255, 128, 0);
    corner1 = new Location(10, 275);
    corner2 = new Location(50, 318);
    corner3 = new Location(-5, 325);
    triangle2 = new Triangle(corner1, corner2,
    corner3, location, colororange);
    offset3 = new Location (265, 35);
    triangle2.changeCorners (offset3);
    //right foot
    location = new Location (200, 10);
    colororange = new Color (255, 128, 0);
    corner1 = new Location(10, 275);
    corner2 = new Location(50, 318);
    corner3 = new Location(-5, 325);
    triangle3 = new Triangle(corner1, corner2,
    corner3, location, colororange);
    offset4 = new Location (155, 60);
    triangle3.changeCorners (offset4);
  public void start() {
  Thread th = new Thread (this);
  th.start();
  public void stop() {
  public void destroy() {
  public void run(){
  int index = 1;
  while (true) {
  repaint ();
  offset = new Location (50+index, 20);
  offset1 = new Location (50+index, 42);
  offset2 = new Location (220+index, -220);
  offset3 = new Location (265+index, 35);
  offset4 = new Location (155+index, 60);
  oval1.changeLocation (offset);
  oval2.changeLocation (offset1);
  triangle.changeCorners (offset2);
  triangle2.changeCorners (offset3);
  triangle3.changeCorners (offset4);
  repaint ();
  index++;
  try
  Thread.sleep(20);
  catch (InteruptedException ex)
  /* Paint the oval */
  public void paint(Graphics g) {
    oval1.paint(g);
    oval2.paint(g);
    triangle.paint(g);
    triangle2.paint(g);
    triangle3.paint(g);
}

public class Part5 implements runnable {should be:
public class Part5 implements Runnable // capitalization matters{You probably should add a constructor, and much of what is in the init method can go in the constructor.
Your code confuses me a bit. It looks as if you are setting locations within your init method, and also trying to move the drawn items via the changeLocation method. I don't have many of your objects to look at, so I can't tell if this suspicion is correct. If you are throwing in some movement code here, I advise you not to do this.
This code here:
  Thread th = new Thread (this);
  th.start();
  }should probably look like so:
  new Thread(new Part5()).start();and shouldn't even be in this class. This would be a way to initialize your object and start the animation from another class, say a class called TestPart5 that has a static main method. For this to work this way, you have to initialize the Part5 class object within a constructor as noted above. Otherwise if you keep things as they are, you'd have to do something like so:
  Part5 p5 = new Part5();
  p5.init(); // have to call init since constructor doesn't fully initialize the object
  new Thread(p5).start();Looks like you have some reading and studying to do. Come back if you have questions.
P

Similar Messages

  • Please help; Need 7 simple errors correcting asap to hand in Monday

    this code i typed has 2 errors; Can someone correct and help please?
    import java.util.scanner;
    public class dh{
    public static void main(String[]args){
    Scanner lire=newScanner(System.in);
    double dh=1,somdudh=0;
    System.out.printlen("reste");
    reste=lire.nextdouble();
    System.out.printlen("nb100dh");
    nb100dh=lire.nextdouble();
    System.out.printlen("nb50dh");
    nb50dh=lire.nextdouble();
    System.out.printlen(m);
    m=lire.nextdouble();
    While (dh!=0);{
    System.out.printlen("entrer le montrant");
    dh=lire.nextdouble();
    somdudh=somdudh+dh;
    System.out.printlen("vous devez"+dh+"dirhams")
    System.out.printlen("montrant verse");
    m=lire.nextdouble();
    reste=m-dh;
    nb100dh=0;
    While (reste>=100){
    nb100dh=nb100dh+1;
    m=lire.nextdouble();
    reste=reste-100;
    nb50dh=0;
    if(reste>=50)
    {reste=reste-50;}
    System.out.printlen("rendu de la monnaie");
    System.out.printlen("billets de 100dh nb100dh");
    System.out.printlen("billets de 50 dh nb50dh");
    System.out.printlen("pieces de 10 dh reste");
    Thank you,
    Amissan

    goodmorning;i want to think you a lot ,i do want you advice me to do but i still have one problrm please could you check my new code pleaseimport java.util.Scanner;
    public class Dirhams{
    public static void main(String[]args){
    Scannerlecture=new Scanner(System.in);
    double dh=1;
    double somdudh=0;
    double reste;
    double m;
    double nb100dh;
    double nb50dh;
    while (dh!=0){
    System.out.println("entrer le montrant:");
    dh=lecture.nextDouble();
    somdudh=somdudh+dh;
    System.out.println("vousdevez"+dh+"dirhams");
    System.out.println("montrant verse"+m);
    m=lecture.nextDouble();
    System.out.println("reste");
    reste =m-dh;
    nb100dh=0;
    while (reste>=100){
    nb100dh=nb100dh+1;
    reste=reste-100;
    nb50dh=0;
    if(reste>=50)
    {nb50dh=1;
    reste=reste-50;}
    System.out.println("rendu de la monnaie");
    System.out.println("billetsde100dh"+nb100dh);
    System.out.println("billets de 50dh"+nb50dh);
    System.out.println("pieces de 10 dh"+reste);
    it s give me 3 errors
    1/^Scannerlecture=new Scanner(system.in);
    2/dh=^lecture.nextDouble();
    3/m=lecture.nextdouble();
    these are the 3 errors
    thank you once again                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Generating BCH Codes for Forward Error Correction

    Has anybody created VIs for generating BCH (Bose-Chaudhuri-Hochquenghem) error correction codes?
    I need to generate the codes for a 16 bit data packet.
    I've found samples in C on the web (http://www.eccpage.com/) but nothing in LV.
    Thanks,
    -dave

    I hate to bump a topic that is over 6 years old, but I am in need of a simple BCH encoding algorithm and do not have the toolbox which provides this.  I only need the encoding algorithm so I am hoping to implement this .VI posted here. 
    I have slightly altered the cleaned up version that was posted to have the inputs/outputs in a format that I expect, but I am worried that it is not correctly calculating the BCH code.  This is my first time working with BCH codes, but I need to implement the CCSDS version using n = 63, k = 56 7-bit BCH code with generator polynomial G(x) = x^7 + x^6 + x^2 + 1.
    I think when using 0xC5C5C5C5C5C5C5 as my input message the 7 bit BCH is supposed to be 0x43, but I am getting 0x00.  Could someone with more experience than me see if I did something obviously wrong?  Or know of a way to validate a BCH encoding algorithm, so I know if what I did was correct.  I attached my modeified .vi.  Thanks!
    Attachments:
    BCH_3.vi ‏24 KB

  • ITunes Will Not Play Entire CDs Unless Error Correction Switched Off!

    I was having problems with iTunes in that it would only play 2 tracks on a CD before iTunes froze and had to be Force Quit.
    On the advice of a poster on this Apple Discussions Forum I went into: iTunes>Preferences>Advanced>Importing and unchecked the "Use error correction" button. Voila, my iTunes will now play complete CDs.
    But surely this is not right? It has been suggested to me that this is a software issue and that I should carry out an archive and install of Leopard.
    What do you think?

    +4. Windows blue screen comes up to check the FAT32 drive to see if there are any errors. There is nothing.+
    what numerical and text codes are you getting with it? (ie 0x[zeros/letters/numbers] CAPSANDUNDERSCORES)
    if the blue screen mentions a specific file, let us know what that is called too. (exact spelling, please.)
    here's a reference on the sorts of things i'm asking about:
    Troubleshooting Windows Stop Messages

  • @Return - Help with displaying error correctly

    Hi,
    I'm trying to use the @Return function to block users from entering a negative value in the 'FTE' member of the 'F T E' dimension.  When I run the below from Business Rules menu it displays the error correctly in a window.  However when I run when it's attached to a webform which I need, the error displays as:
    Error Detected while attempting to run job:  AAA - Non Discretionary Allocation - Budget.
    ADF_FACES-60097: For more information, please see the servers' error log for an entry beginning with:  ADF_FACES-60096:Server Exception during PPR, #3
    So my question is why does it work perfectly from Business Rules menu but not from the Webforms?
    Fix (  "No FTE" )
             "512100" (
             If(@ISMBR("8900"))
             If("FTE" < 0)
             @RETURN( @CONCATENATE(
                                 @CONCATENATE("Negative values are not allowed as input into the dimension 'F T E' for member:[", @NAME(@CURRMBR("F T E"))),
                                 "]. Please input a value greater or equal to zero to continue.")
             , ERROR);
            ELSE
             @Round("FTE" * "Avg School Principal Salary"->"No Dept"->"Preliminary (Rolled)"->"No Fund"->"No Program",-2);
             Endif Endif )

    Is that your real script? If you are only looking at "No FTE" (assuming it is from "F T E" dimension) why currmbr?
    What is 8900 and 512100 are they accounts? If so why are you opening 512100 and checking for 8900?
    If I were you and trying something like this and hit and error, I would try to put a value and see if that works or not. So if FTE<0 put 1 else put the formula.
    Regards
    Celvin

  • Forward Error Correction

    I'm trying to find a way to implement Forward Error Correction (FEC) in Java, and if possible, find a code that someone has wirtten b4.
    Can any1 plz help me? I need this FEC in a one way communication.

    BTW, I want this in native Java (not C, like swarmcast)

  • Import Settings, Use error correction

    I just read that the "Use error correction when reading Audio CDs" box in iTunes Import Settings should really be on, (even though it's slower).
    on this page http://www.kenrockwell.com/apple/itunes.htm It's copyright 2006
    Is this really the case?

    Hi
    An up for this topic.
    Always the same question : use correction or not.
    Nobody knows today how this function works (except Apple may be...)
    When error correct is off : in case of problem, Is the player works like a cd player, creating a /making a new information or does he pass many times until having the good information.
    When error correction is on : In case of problem what happend ? does he pass many times (thats why its slower...) until having the good information ?
    The way is having bit perfect at the end even it is long...
    An idea ?

  • How import CDs in Lossless Format with Error Correction?

    When I check the error correction option and try to import a CD in Apple Lossless format, it pretends to import the CD very quickly -- it takes less than 30 seconds -- but the tracks have no data. If I uncheck error correction, I can import the CD just fine -- takes the expected time. I only stumbled on this when trying to isolate a noise problem with a CD I'd imported.
    I've found this problem mentioned in recent years on Audio Asylum, Audiogon, and Head-Fi forums, but without any explanation for what's up.
    I've made sure all my software (OS and application) is current.
    I'd appreciate any clues or pointers to threads that discuss what's going on here. I've tried to search this site but have not had any luck.
    Thanks in advance,
    __Roy
    Lenovo T60 Windows XP Pro Various working new CD readers, internal and USB.
    Lenovo T60   Windows XP Pro  

    Hi,
    Referencing: https://supportforums.cisco.com/thread/2095711
    Have you followed the steps outlined in page 72 of this guide?  This should be applicable to 792x.
    http://www.cisco.com/en/US/docs/voice_ip_comm/cuipph/7925g/7_0/english/deployment/guide/7925dply.pdf
    Do you have any trace logs from the phone you can post after your attempt to import the cert?

  • 5C00 error correction on MG8120

    Can I fix error 5C00 on my MG8120?

    Okay so last night was a really interesting adventure in DV land. I found out more than I ever thought I would ever want to know about DV (wiki dv to see) and HDV. I guess error correction is an on-tape thing and the error correction never makes it to FCP (the camera doesn't send it, but uses it to fix the signal before it gets sent out via firewire). I was capturing from camera to Macbook then straight to a firewire drive I had (my macbook is basically a "pass-thru"). Turns out the problem was a bent or broken wire in the cable itself (we finally put it on a multitester and I forget which, but one of the wires was giving us a lot of resistance). New cable = no more lost frames.
    I want to thank everyone for their helpful questions, you got me thinking in the right direction.

  • AS5400 Error Correction

    I have a customer who is receiving PPP failure when placing outbound calls through my AS5400. How do I check to see if error correction is turned on?
    I was able to detect this on the AS5300 but I'm not sure about the 5400 (IOS version 12.3)

    You will find few information regarding error correction settings in this link
    http://www.cisco.com/univercd/cc/td/doc/product/software/ios122/122newft/122limit/122x/122xb/122xb_2/122xb2_2/ftv92moh.htm

  • Using "Error Correction"

    When importing a CD using “Apple Lossless Encoder” is ok to leave the preference set to “Use error correction when reading Audio CDs”? I know it slows the transfer down but is the quality compromised in any way? Even on pristine CDs?

    I always use the error correction. The optical drive does it's own error correction, but the software takes it one step further. I don't see it reducing the speed of an import by a significant amount. But since you're clearly a major audiophile, it seems like you would rather be safe than sorry and do the error correction no matter how pristine you think your CDs are.

  • Error correction always on - bad for undamaged tracks?

    I still have a lot of CD's that I still want to import. They are of varying quality. Most have been kept in binders, and depending on where they are in the binder, they are more or less scratched. No doubt some will have audio errors if I import without correction, while most probably will not.
    What I don't want to do is import them all without correction and discover flaws at random weeks or months from now, and always worry that there are more lurking in my library that I haven't uncovered yet or will only hear when I play it on better equipment. I want to import everything once at high quality and never do it again, put my CDs in dark storage, and port this data around from drive to drive, computer to computer, pod to pod, for the next 70 years and then pass it on to my children.
    I am inclined to leave error correction always on so that I'll be always covered if there are errors. My question is this: does this slightly degrade to good data that contains no errors? Does error correction somehow reprocess everything and somehow guess as to what's an error and what's not, and then reconstitute the final as it sees fit? Or is it very good at recognizing and correcting only true errors?

    so no data loss? Slow is ok, as long as it's automated (which it is). One slow import is about 10 times faster than one fast import + errors discovered later + reimporting + deleting bad files and rebuilding playlists, etc.

  • Error Correction doesn't work

    Using WIn Vista, AMD AM2 6000+
    This is a fresh install (actually tried twice incase it was a problem with the Vista install). I can't load ANY cd with error correction on and with it off, I get skipps in the files.
    iTunes version 7.3.1.3
    It works great in XP

    Using WIn Vista, AMD AM2 6000+
    This is a fresh install (actually tried twice incase it was a problem with the Vista install). I can't load ANY cd with error correction on and with it off, I get skipps in the files.
    iTunes version 7.3.1.3
    It works great in XP

  • Error Correction Support - 9i

    Hi
    Does anyone have the dates for Error Correction Support / Extended Support for
    9i Release 2 and 10g Release 2.
    I cannot seem to find any link on the Oracle site!
    Pete

    Hi,
    have a look at
    http://www.oracle.com/support/library/data-sheet/oracle-lifetime-support-policy-datasheet.pdf
    Here you can find:
    9.2 PremiumSupport until Jul 2007 Extended Support until Jul 2010
    10.2 PremiumSupport until Jul 2010 Extended Support until Jul 2013

  • Error correction

    Can anyone recommend an error correction programme which I can download and use with itunes? I find itunes own error correction does not always work and downloaded tracks which were fine on the CD, skip once downloaded.

    If you don't mind MP3s you could use Windows Media player or Real Player. I used to get pretty good results with Realplayer when I used the MP3 format. Now I stick with AAC I get good results with iTunes.
    But there is plenty of ripping software out there, I haven't tried any thing else myself, but I guess others will have recommendations.
    I forgot to mention that error correction can itself introduce problems and is best left off unless needed.
    Message was edited by: polydorus

Maybe you are looking for

  • It's urgent:-Configuaration of my application server into internet

    Can any one will tell me how to configure my application server 9ias version 9.0.2 into internet. My Application server working very fine in intranet but i want to put this into internet it's urgent Waiting for reply. Ajit

  • Join 3 tables using FOR ALL ENTRIES

    Hi, I want to join 3 tables and show their result in a text file delimited by comma. ITs a download program.Can someone tell me how to how to join the three table using for all entires instead of inner join.please give step  by step illustration

  • Owner Login

    I am trying to create a report on Service Request History and one of the requirements is to display the "Owner Login". I see the Owner field in there and there are lot of fields under "Owned By User" but there is none which can be used to display the

  • Usa payroll

    i am new to abap hr can anybody send u.s.a payroll material

  • Any built in function to display hex num in 0xHH format?

    any built in function to display hex num in 0xHH format or do i have to code a method myself? thanks