Please Help Fast!

Hello I have a Program due tommorow and I cannot figure out whats going wrong!

import java.util.*;

publicclass NasaCenter

{

private String nasaName;

private Location nasaLocation;

privatestatic Vector roverList =new Vector();

public NasaCenter(Location givenLocation)

{

nasaLocation = givenLocation;

}

protectedvoid addRover(Rover myRover)

{

this.roverList.addElement(myRover);

}

protected Rover getClosestRover(Location myLocation)

{

int roverPicked = 0;

int i = 0;

double dtemp = 0;

Rover myRover = (Rover) this.roverList.elementAt(0);

double myDistance = myRover.getCurrentLocation().distanceFrom(myLocation);

for (Enumeration e = this.roverList.elements(); e.hasMoreElements();)

{

myRover = (Rover) this.roverList.elementAt(i);

dtemp = myRover.getCurrentLocation().distanceFrom(myLocation);

if (dtemp < myDistance){myDistance = dtemp; roverPicked = i;}

}

return (Rover) this.roverList.elementAt(i);

}

publicvoid moveRoverTo(Location myLocation)

{

Rover roverToMove = getClosestRover(myLocation);

roverToMove.setDestination(myLocation);

}

publicvoid processData(RoverReading myRoverReading)

{

String tempReading =null;

tempReading = myRoverReading.toString();

System.out.println(tempReading +" NasaControl: " + this.nasaName);

}

public Rover getRover(int i)

{

return (Rover) this.roverList.elementAt(i);

}

}

Ok so the is soppose to be my parent Class witch complies perfectly fine... then my child class.

class NasaControlextends NasaCenter

{

publicvoid moveRoverTo(Location myLocation)

{

Rover roverToMove = getClosestRover(myLocation);

roverToMove.setDestination(myLocation);

}

publicvoid addRover(String myString)

{

this.addRover(new Rover(myString));

}

}

and when I try to complie this one I get

NasaControl.java:1: cannot resolve symbol

symbol : constructor NasaCenter ()

location: class NasaCenter

class NasaControl extends NasaCenter

^

1 error

I cannot figure out what it wants from me. Iv tried everything I can think of, but i bet it's some simple answer lol. If anyone knows please help.

[4190 byte] By [Kroogera] at [2007-11-26 20:08:48]
# 1
Sorry I only help slow.
Aknibbsa at 2007-7-9 23:11:40 > top of Java-index,Java Essentials,Java Programming...
# 2
You need help fast? I must be too late then. Sorry...
Djaunla at 2007-7-9 23:11:40 > top of Java-index,Java Essentials,Java Programming...
# 3

1) don't use sms-speak, spell things out.

2) What have you tried ?

3) We know it's a problem with the constructor, try simplifying what can you do with a default constructor ?

4) take away things until it compiles, then add things back in slowly until you run into a problem, then you at least will know what is causing the error.

Aknibbsa at 2007-7-9 23:11:40 > top of Java-index,Java Essentials,Java Programming...
# 4
Well, if I remove the constructor completely it all will compile, but If I leave it there with no body I still get the same error, I cant remove anything else from the constuctor.
Kroogera at 2007-7-9 23:11:41 > top of Java-index,Java Essentials,Java Programming...
# 5

NasaCenter has one constructor:

> public NasaCenter(Location givenLocation)

NasaControl also has one constructor, by default since you didn't write a constructor for that class. The default constructor looks like this (pretending you wrote it):

public NasaControl() { super(); }

It cannot invoke the super class constructor taking no arguments, because there isn't a NasaCenter constructor which takes no arguments.

I would suggest your NasaControl class needs a constructor taking a "givenLocation" argument, and pass that argument to the super constructor.

warnerjaa at 2007-7-9 23:11:41 > top of Java-index,Java Essentials,Java Programming...
# 6

> NasaCenter has one constructor:

> > public NasaCenter(Location givenLocation)

>

> NasaControl also has one constructor, by default

> since you didn't write a constructor for that class.

> The default constructor looks like this (pretending

> you wrote it):

> public NasaControl() { super(); }

>

> It cannot invoke the super class constructor taking

> no arguments, because there isn't a NasaCenter

> constructor which takes no arguments.

>

> I would suggest your NasaControl class needs a

> constructor taking a "givenLocation" argument, and

> pass that argument to the super constructor.

Or that NasaCenter needs a no arguments constructor.

Aknibbsa at 2007-7-9 23:11:41 > top of Java-index,Java Essentials,Java Programming...
# 7
:D Well you guys got it! Thanks alot for the help!
Kroogera at 2007-7-9 23:11:41 > top of Java-index,Java Essentials,Java Programming...