School project, Trying to get rid of errors and be able to compile this in their eclipse program

  Kiến thức lập trình

So I am working on this code for school and I have it almost complete I believe, but am coming up with an error the code and the error is:

Code:

import java.util.ArrayList;
import java.util.Scanner;

public class Driver {
    private static ArrayList<Dog> dogList = new ArrayList<Dog>();
    private static ArrayList<Monkey> monkeyList = new ArrayList<Monkey>();

    // Initialize the lists with some data
    public static void main(String[] args) {
        initializeDogList();
        initializeMonkeyList();

        Scanner input = new Scanner(System.in);
        char option;

        do {
            // Displaying the menu to the user.
            displayMenu();
            option = input.next().charAt(0);
            // getting the users choice from menu and handling it.
            switch (option) {
                case '1':
                    intakeNewDog(input);
                    break;
                case '2':
                    intakeNewMonkey(input);
                    break;
                case '3':
                    reserveAnimal(input);
                    break;
                case '4':
                    printAnimals(option);
                    break;
                case '5':
                    printAnimals(option);
                    break;
                case '6':
                    printAnimals(option);
                    break;
                case 'q':
                    System.out.println("Goodbye, we will now close the application");
                    break;
                default:
                    System.out.print("Invalid selection. Please try again.");
            } // continues till user chooses to quit.
        } while (option != 'q');

        input.close();
    } //Displaying the main menu options to the user:
    public static void displayMenu() {
        System.out.println("nn");
        System.out.println("ttttRescue Animal System Menu");
        System.out.println("[1] Intake a new dog");
        System.out.println("[2] Intake a new monkey");
        System.out.println("[3] Reserve an animal");
        System.out.println("[4] Print a list of all dogs");
        System.out.println("[5] Print a list of all monkeys");
        System.out.println("[6] Print a list of all animals that are not reserved");
        System.out.println("[q] Quit application");
        System.out.println();
        System.out.println("Enter a menu selection");
    }
    // initialize the list with dogs as a sample
    public static void initializeDogList() {
        Dog dog1 = new Dog("Spot", "German Shepherd", "male", "1", "25.6", "05-12-2019", "United States", "intake", false, "United States");
        Dog dog2 = new Dog("Rex", "Great Dane", "male", "3", "35.2", "02-03-2020", "United States", "Phase I", false, "United States");
        Dog dog3 = new Dog("Bella", "Chihuahua", "female", "4", "25.6", "12-12-2019", "Canada", "in service", true, "Canada");

        dogList.add(dog1);
        dogList.add(dog2);
        dogList.add(dog3);
    }
    // same with the monkeys initializing the monkeys this time.
    public static void initializeMonkeyList() {
        Monkey monkey1 = new Monkey("Bob", "male", "1", "9", "06-01-1992", "USA", "in service", false, "USA", "Capuchin", "10.3", "12.3", "23.3");
        Monkey monkey2 = new Monkey("charlie", "male", "8", "07-20-1993", "China", "in service", false, "China", "Guenon", "11.2", "2.4", "22.3");
        Monkey monkey3 = new Monkey("Mika", "female", "6", "12-6-1965", "Argentina", "in service", true, "Argentina", "Macaque", "12.4", "10.2", "19.2");

        monkeyList.add(monkey1);
        monkeyList.add(monkey2);
        monkeyList.add(monkey3);
    }
    // in take dog and add it to a list
    public static void intakeNewDog(Scanner scanner) {
        System.out.println("What is the dog's name?");
        String name = scanner.nextLine();
        for (Dog dog : dogList) {
            if (dog.getName().equalsIgnoreCase(name)) {
                System.out.println("nnThis dog is already in our systemnn");
                return; //returns to menu
            } // exits the menu if dog is in the system already.
        }
// collects other details of the dog if the dog is not in the system already.
        System.out.println("What is the dog's breed?");
        String breed = scanner.nextLine();
        System.out.println("What is the dog's gender?");
        String gender = scanner.nextLine();
        System.out.println("What is the dog's age?");
        String age = scanner.nextLine();
        System.out.println("What is the dog's weight?");
        String weight = scanner.nextLine();
        System.out.println("What is the dog's acquisition date?");
        String acquisitionDate = scanner.nextLine();
        System.out.println("What is the dogs acquisition country?");
        String acquisitionCountry = scanner.nextLine();
        System.out.println("Which country is the dog in service currently?");
        String inServiceCountry = scanner.nextLine();
        System.out.println("What is the dog's training status?");
        String trainingStatus = scanner.nextLine();
        boolean reserved;
        // while code hands the boolean input for reservation status.
        while (true) {
            try {
                System.out.println("Is this dog reserved? (true/false)");
                reserved = scanner.nextBoolean();
                scanner.nextLine();
                break;
            } catch (InputMismatchException e) {
                System.out.println("Please enter true or false only.");
                scanner.nextLine();
            }
        }

        Dog dog4 = new Dog(name, breed, gender, age, weight, acquisitionDate, acquisitionCountry, trainingStatus, reserved, inServiceCountry);
        dogList.add(dog4);
        System.out.println("Your entry has now been added to the list of dogs.");
    }
    // find out if the monkey is in the system.
    public static void intakeNewMonkey(Scanner scanner) {
        System.out.println("What is the monkey's name?");
        String name = scanner.nextLine();
        for (Monkey monkey : monkeyList) {
            if (monkey.getName().equalsIgnoreCase(name)) {
                System.out.println("This monkey is already in the system.");
                return;
            }
        }
//  if not then ask more questions about monkey
        System.out.println("What is the monkey's name");
        String name = scanner.nextLine();
        System.out.println("What is the monkey's species?");
        String species = scanner.nextLine();
        System.out.println("What is the monkey's gender?");
        String gender = scanner.nextLine();
        System.out.println("What is the monkey's age");
        String age = scanner.nextLine();
        System.out.println("What is the monkey's weight");
        String weight = scanner.nextLine();
        System.out.println("What is the monkey's acquisition date?");
        String acquisitionDate = scanner.nextLine();
        System.out.println("What is the monkeys acquisition country?");
        String acquisitionCountry  = scanner.nextLine();
        System.out.println("What is the Monkey's training status?");
        String trainingStatus = scanner.nextLine();
        System.out.println("Is this monkey reserved?");
        boolean reserved = scanner.nextBoolean();
        System.out.println("What is the Monkey's in service country?");
        String inServiceMonkey = scanner.nextLine();
        System.out.println("What is the tail length?");
        int tailLength = scanner.nextInt();
        System.out.println("What is the height?");
        int height = scanner.nextInt();
        System.out.println("What is the body length?");
        int bodyLength = scanner.nextInt();
     //create the monkey list and add it to it.
        Monkey monkey = new Monkey(name, gender, age, weight, acquisitionDate, acquisitionCountry, trainingStatus, reserved,String inServiceCountry, species, int tailLength, int height, int bodyLength);
        monkeyList.add(monkey);
        System.out.println("Your entry has been added to the list of monkeys.");
    }
    //reserve animal based on users input of details
    public static void reserveAnimal(Scanner scanner) {
        scanner.nextLine();
        System.out.println("Enter the animal type: ");
        String animalType = scanner.nextLine();
        if (animalType.equalsIgnoreCase("Monkey")) {
            System.out.println("Enter the monkeys acquisition country: ");
            String country = scanner.nextLine();
            for (Monkey obj : monkeyList) {
                if (obj.getAcquisitionLocation().equalsIgnoreCase(country)) {
                    obj.setReserved(true);
                    System.out.println("This monkey is now reserved.");
                    return;
                }
            }
            System.out.println("The monkey entered is not in the list.");
        } else if (animalType.equalsIgnoreCase("Dog")) {
            System.out.println("Enter the dog's acquisition country: ");
            String country = scanner.nextLine();
            for (Dog obj : dogList) {
                if (obj.getAcquisitionLocation().equalsIgnoreCase(country)) {
                    obj.setReserved(true);
                    System.out.println("This dog is now reserved.");
                    return;
                }
            }
            System.out.print("The dog entered is not in the list.");
        } else {
            System.out.println("Animal type not found.");
        }
    }

    public static void printAnimals(char option) {
        if (option == '4') {
            System.out.println("List of all dogs: ");
            for (Dog dog : dogList) {
                System.out.println(dog);
            }
        } else if (option == '5') {
            System.out.println("List of all monkeys: ");
            for (Monkey monkey : monkeyList) {
                System.out.println(monkey);
            }
        } else if (option == '6') {
            System.out.println("List of all unreserved animals in service: ");
            for (Dog dog : dogList) {
                if (dog.getTrainingStatus().equals("in service") && !dog.isReserved()) {
                    System.out.println(dog);
                }
            }
        }
        for (Monkey monkey : monkeyList) {
            if (monkey.getTrainingStatus().equals("in service") && !monkey.isReserved()) {
                System.out.println(monkey);
            }
        }
    }
}

the error is:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    The constructor Monkey(String, String, String, String, String, String, String, String, boolean, String, String, String, String, String) is undefined
    The constructor Monkey(String, String, String, String, String, String, String, boolean, String, String, String, String, String) is undefined
    The constructor Monkey(String, String, String, String, String, String, String, boolean, String, String, String, String, String) is undefined

    at Driver.initializeMonkeyList(Driver.java:75)
    at Driver.main(Driver.java:11)

any help is appreciated, I have re done this code numerous times and keep coming up with it.

I have re done the code (Re wrote) I have tried different methods of fixing the different errors this one has me at a loss.

for reference the Monkey class file is:

public class Monkey extends RescueAnimal {

    private String species;
    private int tailLength;
    private int height;
    private int bodyLength;

    public Monkey() {
    } {
        super();
    }

    public Monkey(String name, String species, String gender, String age, String weight,
                  String acquisitionDate, String acquisitionCountry, String trainingStatus, 
                  boolean reserved, String inServiceCountry, int tailLength, int height, int bodyLength) {
        setName(name);
        setSpecies(species);
        setGender(gender);
        setAge(age);
        setWeight(weight);
        setAcquisitionDate(acquisitionDate);
        setAcquisitionLocation(acquisitionCountry);
        setTrainingStatus(trainingStatus);
        setReserved(reserved);
        setInServiceCountry(inServiceCountry);
        this.tailLength = int tailLength;
        this.height = int height;
        this.bodyLength = int bodyLength;
    }

    public String getSpecies() {
        return species;

    }
    public void setSpecies(String species) {
        this.species = species;
    }
    public int getTailLength() {
        return tailLength;
    }

    public void setTailLength(int tailLength) {
        this.tailLength = tailLength;
    }
    public int getHeight() {
        return height;
    }
    public void setHeight(int height) {
        this.height = height;
    }
    public int getBodyLength() {
        return bodyLength;
    }
    public void setBodyLength(int bodyLength) {
        this.bodyLength = bodyLength;
    }
}

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT