subject

LAB: Pet information (derived classes) The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dog Breed. Complete main() to: • create a generic pet and print information using printinfo(). • create a Dog pet, use printInfo() to print information, and add a statement to print the dog's breed using the getBreed method. Ex. If the input is: Dobby Kreacher German Schnauzer the output is: Pet Information: Name: Dobby Age: 2 Pet Information: Name: Kreacher Age: 3 Breed: German Schnauzer LAB ACTIVITY 100 10.9.1: LAB: Pet information (derived classes) 0/10 Current file: PetInformation. java - Load default template... 1 import java. util. Scanner; public class Pet Information { public static void main(String[] args) { Scanner scnr = new Scanner(System. in); Pet my Pet = new Pet(); Dog myDog = new Dog(); String petName, dogName, dogBreed; int petAge, dogAge; petName = scnr. nextLine(); petAge = scnr. nextInt(); scnr. nextLine(); dogName = scnr. next(); dogAge = scnr. nextInt(); scnr. nextLine(); dogBreed = scnr. nextLine();

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, Leggett8152
What best describes a career pathway in a lodging career? a worker starts out as an amusement attendant, then becomes a recreation worker, and then becomes a gaming worker within five years. a worker starts out as a bell hop, then becomes a night clerk, and then becomes a hotel manager within five years. a worker starting out as a tour guide, then becomes a travel clerk, and then becomes a travel agent within five years. a worker starts out as a server, then becomes a food preparer, and then becomes a head chef within five years.
Answers: 1
image
Computers and Technology, 22.06.2019 14:30, megkate
Complete the sentence based on your knowledge of the professional difficulties faced by music artists. digital technology allows audiences to see free live telecasts of music or dance performances through
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, deeknuk
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, hargunk329
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
You know the right answer?
LAB: Pet information (derived classes) The base class Pet has private fields petName, and petAge. Th...

Questions in other subjects: