I need help with this
Mammal:
public class Mammal extends Pet{
String Vaccination="";
public Mammal(String name, String parent, String
species, String birthday, String Vaccination) {
//Accessing
the super class Constructor and setting the variables.
super(name,parent,species, birthday);
this.Vaccination=Vaccination;
} // end Mammal
public String getVaccination() {
return
Vaccination;
} // end getVaccination
public void setVaccination(String
Vaccination) {
this.Vaccination =
Vaccination;
} // end setVaccination
@Override
public String toString() {
return
super.toString()+". This Mammal requires following vaccinations "+
Vaccination;
} // end toString
} // end class Mammal
Reptile:
public class Reptile extends Pet{
String environment="";
public Reptile(String name, String parent,
String species , String birthday, String environ) {
//Accessing the super
class Constructor and setting the variables.
super(name,parent,species,
birthday);
this.environment=environ;
} // end Reptile
public String getEnvironment() {
return
environment;
} // end method getEnvironment
public void setEnvironment(String
environment) {
this.environment =
environment;
} // end method setEnvironment
@Override
public String toString() {
return
super.toString()+". The Reptile's required environment is "+
environment;
} // end method toString
} // end class Reptile
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
_________________
// Pet.java
public class Pet {
private String name;
private String species;
private String parent;
private String birthday;
public Pet() {
this.name = "";
this.species = "";
this.parent = "";
this.birthday = "";
}
public Pet(String name, String species, String
parent, String birthday) {
this.name = name;
this.species = species;
this.parent = parent;
this.birthday = birthday;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSpecies() {
return species;
}
public void setSpecies(String species) {
this.species = species;
}
public String getParent() {
return parent;
}
public void setParent(String parent) {
this.parent = parent;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
@Override
public String toString() {
return "Pet : Name=" + name + ",
Species=" + species + ", Parent="
+ parent + ", Birthday=" + birthday;
}
}
_____________________
// Mammal.java
public class Mammal extends Pet {
String Vaccination = "";
public Mammal(String name, String parent, String
species, String birthday,
String
Vaccination) {
// Accessing the super class
Constructor and setting the variables.
super(name, parent, species,
birthday);
this.Vaccination =
Vaccination;
} // end Mammal
public String getVaccination() {
return Vaccination;
} // end getVaccination
public void setVaccination(String Vaccination)
{
this.Vaccination =
Vaccination;
} // end setVaccination
@Override
public String toString() {
return super.toString()+ ". This
Mammal requires following vaccinations "+ Vaccination;
} // end toString
} // end class Mammal
________________________
// Reptile.java
public class Reptile extends Pet{
String environment="";
public Reptile(String name, String parent, String species , String
birthday, String environ) {
//Accessing the super class Constructor and setting the
variables.
super(name,parent,species, birthday);
this.environment=environ;
} // end Reptile
public String getEnvironment() {
return environment;
} // end method getEnvironment
public void setEnvironment(String environment) {
this.environment = environment;
} // end method setEnvironment
@Override
public String toString() {
return super.toString()+". The Reptile's required environment is "+
environment;
} // end method toString
} // end class Reptile
_______________________
// Test.java
public class Test {
public static void main(String[] args) {
Pet p=new Pet("Kitty","Profelis
Aurata","Billy","2007/02/28");
Mammal m=new Mammal("Bear","Boxy","Ursus
Maritimus","2010/02/29","Purevax");
Reptile r=new Reptile("Crocodile", "Milly","pterosaurs"
,"2017/03/31", "Water");
System.out.println(p);
System.out.println(m);
System.out.println(r);
}
}
_________________________
Output:
Pet : Name=Kitty, Species=Profelis Aurata,
Parent=Billy, Birthday=2007/02/28
Pet : Name=Bear, Species=Boxy, Parent=Ursus Maritimus,
Birthday=2010/02/29. This Mammal requires following vaccinations
Purevax
Pet : Name=Crocodile, Species=Milly, Parent=pterosaurs,
Birthday=2017/03/31. The Reptile's required environment is
Water
_______________Could you plz rate me well.Thank
You
I need help with this Mammal: public class Mammal extends Pet{ String Vaccin...
public class Pet { //Declaring instance variables private String name; private String species; private String parent; private String birthday; //Zero argumented constructor public Pet() { } //Parameterized constructor public Pet(String name, String species, String parent, String birthday) { this.name = name; this.species = species; this.parent = parent; this.birthday = birthday; } // getters and setters public String getName() { return name; ...
*PLEASE HELP ASAP* Pet.java /* * Class Pet * * * */ public class Pet { /* * Instance variables */ private String name; private String species; private String parent; private String birthday; /* * Constructors */ public Pet( ) { // This is a null or default constructor } //e end null constructor public Pet( String aName, String aSpecies, String aParent, String aBDay ) { setName( aName ); setSpecies( aSpecies ); setParent( aParent ); setBirthday( aBDay ); } //...
Code in JAVA UML //TEST HARNESS //DO NOT CHANGE CODE FOR TEST HARNESS import java.util.Scanner; // Scanner class to support user input public class TestPetHierarchy { /* * All the 'work' of the process takes place in the main method. This is actually poor design/structure, * but we will use this (very simple) form to begin the semester... */ public static void main( String[] args ) { /* * Variables required for processing */ Scanner input = new Scanner( System.in...
Please help to answer ASAP Class Parent {Parent(String s) {System.out.println("S1");}} class Child extends Parent {public Child() {System.out.println("S2");}} Identify the correct statements for the above code snippet super();//automatically inserted here in class file of Child super("Hello");//inserted here in class file of Child compilation error Compiles successfully
Hey I really need some help asap!!!! I have to take the node class that is in my ziplist file class and give it it's own file. My project has to have 4 file classes but have 3. The Node class is currently in the ziplist file. I need it to be in it's own file, but I am stuck on how to do this. I also need a uml diagram lab report explaining how I tested my code input...
Write a class named Octagon (Octagon.java) that extends the following abstract GeometricObject class and implements the Comparable and Cloneable interfaces. //GeometricObject.java: The abstract GeometricObject class public abstract class GeometricObject { private String color = "white"; private boolean filled; private java.util.Date dateCreated; /** Construct a default geometric object */ protected GeometricObject() { dateCreated = new java.util.Date(); } /** Construct a geometric object with color and filled value */ protected GeometricObject(String color, boolean filled) { dateCreated = new java.util.Date(); this.color = color;...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...
I need help running this code. import java.util.*; import java.io.*; public class wordcount2 { public static void main(String[] args) { if (args.length !=1) { System.out.println( "Usage: java wordcount2 fullfilename"); System.exit(1); } String filename = args[0]; // Create a tree map to hold words as key and count as value Map<String, Integer> treeMap = new TreeMap<String, Integer>(); try { @SuppressWarnings("resource") Scanner input = new Scanner(new File(filename));...
Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called getDeansList() as described below. Refer to Student.java below to learn what methods are available. I will paste both of the simple .JAVA codes below COURSE.JAVA import java.util.*; import java.io.*; /****************************************************** * A list of students in a course *****************************************************/ public class Course{ /** collection of Students */ private ArrayList<Student> roster; /***************************************************** Constructor for objects of class Course *****************************************************/...
CAN SOMEONE PLEASE SOLVE THIS? THANK YOU. FINALTREE.JAVA: import java.util.LinkedList; public class FinalTree<E extends Comparable<? super E>> { private Node<E> root; private int size; public FinalTree() { root = null; size = 0; } public boolean isEmpty() { return size == 0; } public void add(E newItem) { if (isEmpty()) { root = new Node<E>(newItem); } else { Node<E> parent = null; Node<E> temp = root; int result = 0; while (temp != null) { parent = temp; result =...