Question
I'm pretty close on the coding but nothing is showing on my output for my Eclipse application please advise. /Java class Pet public class Pet
I'm pretty close on the coding but nothing is showing on my output for my Eclipse application please advise.
/Java class Pet public class Pet { public static void main(String args[]) { } //private member variables public String name; public int age; public String species; public double weight; //public methods to access and change the values of these variables public void setName(String name) { this.name=name;//set name } public String getName() { return this.name;//return name } public void setSpecies(String species) { this.species=species;//set species } public String getSpecies() { return this.species;//return species } public void setAge(int age) { this.age=age;//set age } public int getAge() { return this.age;//return age } public void setWeight(double weight) { this.weight=weight;//set weight } public double getWeight() { return this.weight;//return weight } //display() method public String display() { //return string return "A "+this.age+" year old "+this.species+" named "+this.name+" that weighs "+this.weight+" pounds."; } }
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