I see so many examples everywhere and none of them helped me fix these problems, so if anyone can help me I would greatly appreciate it. I have explained my errors in the red Highlighted sections in comment form....

package lab41thestockclass;
class ParkedCar
{
    private String make;
    private String model;
    private String color;
    private String licnum;
    public int minparked;
    //private double currentPrice;

  public ParkedCar(String mk, String mod, String col, String lic, int min)
  {
        mk = make;
        mod = model;
        col = color;
        lic = licnum;
        min = minparked;
  }
    public ParkedCar(ParkedCar car2)
    {
        make = car2.make;
        model = car2.model;
        color = car2.color;
        licnum = car2.licnum;
        minparked = car2.minparked;
    }


  public String getMake()
  {
        return make;
  }

  public String getModel()
  {
        return model;
  }

  public String getColor()
  {
        return color;
  }

  public String licnumber()
  {
        return licnum;
  }

  public int minparked()
  {
        return minparked;
  }

  public void setMake(String make)
  {
        this.make = make;
  }

  public void setModel(String model)
  {
        this.model = model;
  }

  public void setColor(String color)
   {
        this.color = color;
  }

   public void setLicnum(String licnum)
   {
        this.licnum = licnum;
  }
    public void setMinParked(int minparked)
   {
        this.minparked = minparked;
  }
}//end ParkedCar class

class ParkingMeter
{
    public int minutesPurchased;

  public ParkingMeter(int m)
  {
        m = minutesPurchased;
        
  }
  
  public void setMinutesPurchased(int minutesPurchased)
   {
        this.minutesPurchased = minutesPurchased;
  }
    public int getMinutesPurchased()
  {
        return minutesPurchased;
  }
}//end ParkingMeter class

class ParkingTicket
{
    private ParkedCar car;
    private PoliceOfficer officer;
    private double fine;
    private int minutes;
    private double BASE_FINE = 25.00;
    private double HOURLY_FINE = 10.00;
    int temp;
    
    
    public void CalcFine(int m, double newFine)
    {
      // Determine whether the car is illegally parked.
if (ParkedCar.minparked > ParkingMeter.minutesPurchased)
    /*non static variable error here ^^*/
// Determine the amount of the fine.
if (ParkedCar.minparked - ParkingMeter.minutesPurchased <= 60)
    /*non static variable error here ^^*/
fine = BASE_FINE;
else
fine = BASE_FINE + (10 * ((ParkedCar.minparked - ParkingMeter.minutesPurchased) / 60));
/*non static variable error here ^^*/

// Create a ParkingTicket object, passing
// 3 objects as arguments to the constructor.
parkingticket = new ParkingTicket(fine, parkedcar, parkingmeter);
/*cannot find symbol error here*/
    }
   public ParkingTicket(ParkedCar aCar, PoliceOfficer aOfficer, int min)
  {
        aCar = car;
        aOfficer = officer;
        min = minutes;
  }
  public ParkingTicket(double newFine)
  {
      fine = newFine;
  }

  public ParkedCar getCar()
  {
        return car;
  }

  public PoliceOfficer getOfficer()
  {
        return officer;
  }

  public double getFine()
  {
        return fine;
  }

  public int getMinutes()
  {
        return minutes;
  }

  public double getBASE_FINE()
  {
        return BASE_FINE;
  }

  public double getHOURLY_FINE()
  {
        return HOURLY_FINE;
  }

  public ParkedCar setCar(String ParkedCar)
    {
      this.car = new ParkedCar(car);
      return car; /*doesn't show an error when i add this to each one from here to
setHOURLY_FINE*/
  }

  public PoliceOfficer setOfficer(String PoliceOfficer)
  {
        this.officer = new PoliceOfficer(officer);
        return officer;
  }

  public double setFine()
  {
        this.setFine();
        //getting an error saying missing return statement
  }

  public int setMinutes()
  {
        this.setMinutes();
        //getting an error saying missing return statement
  }

  public double setBASE_FINE()
  {
        this.setBASE_FINE();
        //getting an error saying missing return statement
  }

  public double setHOURLY_FINE()
  {
        this.setHOURLY_FINE();
        //getting an error saying missing return statement
  }
  
 public String toString()
{
// Create a string representing the object.
String str = "Illegally parked car info: " + car + "\nParking meter info:" + minutes + "\nAmount of the fine...: " + fine;
//"\nPolice officer info: " + policeofficer;

// Return the string.
return str;
}
}//end ParkingTicket class

class PoliceOfficer
{
    private String name;
    private String badgeNumber;
  

  public PoliceOfficer(String pname, String bnum)
  {
        pname = name;
        bnum = badgeNumber;
  }
    public PoliceOfficer(PoliceOfficer officer2)
    {
        name =  officer2.name;
        badgeNumber = officer2.badgeNumber;
    }
 partrol(ParkedCar ParkingMeter){
     /*supposed to get car from ParkedCar
             meter from ParkingMeter
      but not sure what to put here*/
 }
   
}//end PoliceOfficer class

class Main
{
  public static void main(String[] args)
  {
    //create a ParkedCar object.
    //The car was parked for 125 minutes..
      ParkedCar car = new ParkedCar("Volkswagen","1972","Red","147RHZM", 125);
      
      //Create a ParkingMeter Objec.60 minutes were purchased.
      ParkingMeter meter = new ParkingMeter(60);
      
      //Create a PoliceOfficer object.
      PoliceOfficer officer = new PoliceOfficer("Joe Friday","4788");
      
      //Let Officer partrol.
      ParkingTicket ticket = officer.patrol(car,meter);
      //cannot find symbol
      //symbol somthing about officer.patrol(car,meter)
      
      //Did the officer issue a ticket?
      if(ticket != null)
          System.out.println(ticket);
      else
          System.out.println("No Crimes Were Committed");
      
  }
}

ParkedCar.minparked ParkedCar is the class, so this is a reference to a static variable. But minparked is (correctly) an instance variable. You have to refer to it using an instance of the ParkedCar class, not the class itself, as in
ParkedCar car = (something)
if (car.minparked (etc)

not to sure on what you mean there...i've been working at it for about 8 hours..my brain is fried

Eg

class Demo {
   static int x=0;
   int y = 0;  // instance variable - like yours
  ...
}

// somewhere else...
Demo d = new Demo();
int a;
a = Demo.x;  // correct, x is static
a = Demo.y;  // error, y is an instance variable
a = d.x;     // not strictly an error, but bad practice
a = d.y;     // correct

When you have a number of errors always start by fixing the first one. It's often the case that one error causes further erros later and when yuou fix the first one the others sometimes go away

ps: See this thread from 20 minutes ago - same problem
http://www.daniweb.com/forums/thread318610.html

Edited 6 Years Ago by JamesCherrill: ps

I would like to add something else. Your first constructor is wrong:

public ParkedCar(String mk, String mod, String col, String lic, int min)
{
  mk = make;
}

Here you take the value of make(local attribute) which is null and you assign it to the argument. The idea is to take the argument and put it into the local attribute.
You correctly do that in your second constructor:

public ParkedCar(ParkedCar car2)
{
  make = car2.make;
}

You take the argument car2.make and put it into the make. So do the same at the first constructor:

public ParkedCar(String mk, String mod, String col, String lic, int min)
{
  make = mk;
  model = mod;
}
This article has been dead for over six months. Start a new discussion instead.