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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
For the following example of making a peanut butter and jelly sandwich, identify which are inputs, processes, or outputs: bread scooping and spreading peanut butter plate scooping and spreading jelly finished sandwich putting two pieces of covered bread together dirty plate crumbs
Answers: 2
question
Computers and Technology, 24.06.2019 06:30
Ineed to know the anwser to all these questions
Answers: 2
You know the right answer?
LAB: Pet information (derived classes) The base class Pet has private fields petName, and petAge. Th...
Questions
Questions on the website: 13722361