Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Description Use the Dog, Doggies, and DoggiesRunner classes. Complete the getNameOfOldest and getNameOfYoungest methods in the Doggies class. Sample Output How many Dogs are
Lab Description Use the Dog, Doggies, and DoggiesRunner classes. Complete the getNameOfOldest and getNameOfYoungest methods in the Doggies class. Sample Output How many Dogs are in the pack?:: 5 Enter the age: 20 Enter the name Sammy Enter the age :: 10 Enter the name:Benny Enter the age ::5 Enter the name :: wAdee Enter the age 30 Enter the name:: Kelley Enter the age : 2 Enter the nameBaby pack[20 Sammy, 10 Benny, 5 Wilee, 30 Kelley, 2 Babyl NAME OF OLDEST:: Kelley NAME OF YOUNGEST :: Baby public class Dog private int age; private String name; public Dog (int a, String n) age - a; name n; public String getName () return name; public int getAge) return age; public String toString() return ""+ age + ""+ name; import java.util.Arrays; public class Doggies private Dog[] pups public Doggies (int size) //point pups at a new arry of Dog public void set(int spot, int age, String name) //put a new Dog in the array at spot //make sure spot is in bounds public String getNameOfoldest() return null; public String getNameofYoungest() return null; public String toString() return ""+Arrays.tostring(pups) import java.uti1.Arrays import java.util.Scanner; public class DoggiesRunner public static void main String args) scanner keyboard = new scanner(System.in); System.out.print("How many Dogs are in the pack?:" int size = keyboard . nextInt(); Doggies pack - new Doggies(size)i for (int i-0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started