Hey guys! So I'm making simple PetShop program based on an UML diagram I did. Anyway, I have 4 classes: PetShop(It's the main class), Pet, Customer, Transaction. I'm having an error on line 22 saying it cannot find symbol. I have the adopt() method in the Transaction class. Here's what I have so far:

package petshop;


public class PetShop {


    public PetShop() {
    }

    public static void main(String[] args) {

        Customer[] customers = new Customer[0];
        Pet[] pets = new Pet[0];
        Transaction[] transactions = new Transaction[0];

        Customer chappie = new Customer("Chappie", "Johannesburg St.", "1234567");
        Customer ninja = new Customer("Ninja","London St.", "2345678" );
        Pet dog = new Pet("Dog", "Wiener", 1, 100.00);
        Pet cat = new Pet("Cat", "Persian", 3, 250.00);


        chappie.adopt(dog);
    }
}




package petshop;

public class Transaction {

    private Customer customer;
    private Pet pet;  

        public static void adopt(Customer customer, Pet pet){
            System.out.println("Transaction: ");
            System.out.print(customer.getName()+customer.getAddress()+customer.getContactNum());
            System.out.println(pet.getType()+pet.getBreed()+ pet.getAge()+pet.getPrice());
        }

    public Transaction(Customer customer, Pet pet) {
        this.customer = customer;
        this.pet = pet;
    }

    public Customer getCustomer() {
        return customer;
    }

    public Pet getPet() {
        return pet;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public void setPet(Pet pet) {
        this.pet = pet;
    }

}



package petshop;
public class Pet {

    private String type;
    private String Breed;
    private int age;
    private double price;

    public Pet(String type, String Breed, int age, double price) {
        this.type = type;
        this.Breed = Breed;
        this.age = age;
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public String getBreed() {
        return Breed;
    }

    public int getAge() {
        return age;
    }

    public double getPrice() {
        return price;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setBreed(String Breed) {
        this.Breed = Breed;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setPrice(double price) {
        this.price = price;
    }


}



package petshop;
public class Customer {

    private String name;
    private String Address;
    private String contactNum;       

    public Customer(String name, String Address, String contactNum) {
        this.name = name;
        this.Address = Address;
        this.contactNum = contactNum;
    }

    public String getName() {
        return name;
    }

    public String getAddress() {
        return Address;
    }

    public String getContactNum() {
        return contactNum;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAddress(String Address) {
        this.Address = Address;
    }

    public void setContactNum(String contactNum) {
        this.contactNum = contactNum;
    }



}

Your calling it wrong. It should be:

transactions.adopt(chappie,dog);

This is because your adopt method is defined under the transaction class and accepts a customer and a pet.

Thanks for your input kind sir! I was able to make the program run perfectly! Thanks again! :D

Comments
okay. Mark as solved.
This question has already been answered. Start a new discussion instead.