1234567891011121314151617181920212223242526272829303132333435 |
- import java.util.Scanner;
-
- public class Console
- {
- Scanner scanner = new Scanner(System.in);
-
- public int userSetNumberOfPets()
- {
- System.out.println("Enter number of pets: ");
- return scanner.nextInt();
- }
-
- public String userSetTypeOfPet()
- {
- System.out.println("Enter type of pet: ");
- return scanner.nextLine();
- }
-
- public String userSetNameOfPet()
- {
- System.out.println("Enter name of pet: ");
- return scanner.nextLine();
- }
-
- public void printPets(Pet[] pets)
- {
- System.out.println("Type Name");
- for(int i=0; i<=pets.length-1; i++)
- {
- System.out.print("your " + pets[i].getTypeOfPet()
- + " named " + pets[i].getNameOfPet() + " says " + pets[i].speak() + "\n");
- }
- }
- }
|