Course Solutions Uncategorized (Solved) : Code Dog Class Definition Public Class Dog Definition Initializarion Instance Variables Pr Q36203249 . . . .

(Solved) : Code Dog Class Definition Public Class Dog Definition Initializarion Instance Variables Pr Q36203249 . . . .

 

Add getter and setter methods, for all the instance variables, to the class Dog (right-click on the source code window for th

The code before:

//Dog class definition
public class Dog {

//definition and initializarion of instance variables
private String name = “unknown”;
private String dogBreed = “unknown”;
private int regNum = -1;

//method definition
public String toString(){
   String str = “Dog “+name+”, Breed = “+dogBreed+”,Registration # = “+regNum;
  
   return str;
}
}

//DogBreeder class definition
public class DogBreeder {

// main function definition
public static void main(String[] args) {
     
      //print message
      System.out.println(“Starting DogApplication”);
     
      //Create Dog object
      Dog myDog = new Dog();
     
      //Print instance variable detailsusing myDog object and toString() function
     System.out.println(myDog.toString());

}

}

Add

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post