1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import java.util.Scanner;
-
- public class Console
- {
-
- int numberOfPets;
- String typeOfPet;
- String nameOfPet;
-
- Pet pet = new Pet();
-
- public Console()
- {
-
- }
-
- public int inputNumberOfPets(){
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter number of pets.");
- return scanner.nextInt();
- }
-
- public String inputTypeOfPet(){
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter type of pet.");
- return scanner.nextLine();
- }
-
- public String inputNameOfPet(){
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter name of pet.");
- return scanner.nextLine();
- }
-
- public void printPetInfo(Pet[] petArray){
- for(Pet element: petArray){
- System.out.println(element.getNameOfPet()+" is a "+element.getTypeOfPet()+" and says "+element.speak());
- }
- }
- }
|