samedi 2 juillet 2016

Cannot find Symbol error in Java - why?

I am having a hard time understanding the object oriented world. I am working on a homework assignment and I can't understand why I am getting an error here. The issue I am having is in the add method. I am using the Netbeans IDE (per professor requirement) and the problem I am getting is in the add method. There are two errors that both say "Cannot find Symbol"; one is in reference to the variable customers while the other is in reference to the variable numCustomer. I am trying to understand what I am doing wrong, not just how to fix it.

What I have so far:

package homework6;

/**
 *
 * @author christian
 */

public class Homework6 {
    // Declare variables
    private int numCustomers = 0;
    private Customer customer;

    // Constructor
    public Homework6() {
        Customer[] customers = new Customer[50];
    }

    /**
     * @param args the command line arguments
     */
    public void main(String[] args) {
        System.out.println("Christian Beckman N00963294");
        System.out.println("Homework 6");
        System.out.println(); // Prints a blank line

        // Create and instance of Homework6
        Homework6 homework6 = new Homework6();
        homework6.execute(args);
    }

    private void add(Customer customer) {
        int i = 0;
        customers[i] = customer;
        i++;
        numCustomer++;
    }

    private void displayCustomers() {

    }

    private void execute(String[] args) {

    }

    private int getTotal() {

    }

    private void readFile(String filename) {

    }
}

Aucun commentaire:

Enregistrer un commentaire