1234567891011121314151617181920212223242526272829303132333435
  1. import java.util.Scanner;
  2. public class Console
  3. {
  4. Scanner scanner = new Scanner(System.in);
  5. public int userSetNumberOfPets()
  6. {
  7. System.out.println("Enter number of pets: ");
  8. return scanner.nextInt();
  9. }
  10. public String userSetTypeOfPet()
  11. {
  12. System.out.println("Enter type of pet: ");
  13. return scanner.nextLine();
  14. }
  15. public String userSetNameOfPet()
  16. {
  17. System.out.println("Enter name of pet: ");
  18. return scanner.nextLine();
  19. }
  20. public void printPets(Pet[] pets)
  21. {
  22. System.out.println("Type Name");
  23. for(int i=0; i<=pets.length-1; i++)
  24. {
  25. System.out.print("your " + pets[i].getTypeOfPet()
  26. + " named " + pets[i].getNameOfPet() + " says " + pets[i].speak() + "\n");
  27. }
  28. }
  29. }