Respuesta :
The Java code that follows inserts the code into the main function so that the result may be obtained. It incorporated the appropriate questions related to pet so that users could choose the data they should fill in.
How to name a class?
Proper class naming and naming practises provide the following advantages:
Even if you aren't the person who developed it or if it was written a long time ago, you know what to anticipate from a specific class without looking at code or documentation.
A codebase is simple to find and traverse.
Speaking with your team about issues or improvements is simpler.
It facilitates newbie onboarding and reduces confusion.
A correctly utilised MVP with a defined name standard is generally a nice illustration of working name expectations. You would anticipate that a class named UseCase/Interactor would provide business logic.
How to solve?
import java.util.Scanner;
public class PetInformation {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
String petName, dogName;
String dogBreed = "null";
int petAge, dogAge;
Pet myPet = new Pet();
System.out.println("Enter Pet Name:");
petName = scnr.nextLine();
System.out.println("Enter Pet Age:");
petAge = scnr.nextInt();
Dog myDog = new Dog();
System.out.println("Enter Dog Name:");
dogName = scnr.next();
System.out.println("Enter Dog Age:");
dogAge = scnr.nextInt();
scnr.nextLine();
System.out.println("Enter Dog Breed:");
dogBreed = scnr.nextLine();
System.out.println(" ");
myPet.setName(petName);
myPet.setAge(petAge);
myPet.printInfo();
myDog.setName(dogName);
myDog.setAge(dogAge);
myDog.setBreed(dogBreed);
myDog.printInfo();
System.out.println(" Breed: " + myDog.getBreed());
}
}
To learn more about class naming, visit:
https://brainly.com/question/13464420
#SPJ4