Question

I need help with this

Lab 09 Instructions.pdf (SECURED) - Adobe Reader File Edit View Window Help 75% |▼ Tools Fill 8 Sign Comment Background XML s

UML Class Diagrams Pet Hierarchy.pdf (SECURED) - Adobe Reader File Edit View Window Help 13 68.3% |- Tools Fill 8 Sign Commen

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

Lab 09 Instructions.pdf (SECURED) - Adobe Reader File Edit View Window Help 75% |▼ Tools Fill 8 Sign Comment Background XML serialization requires different preparation than "old school" SER serialization. The first step is creation of a helper dass to provide the rules and structure for creating the XML schema as well as a means of collecting and managing objects for serialization or post-deserialization. Sign In Export PDF Provided to You The following are included in your lab materials Adobe ExportPDF Convert PDF files to Word or Excel online. Select PDF File: These instructions Lab 09 Instructions.pd UML Class Diagrams for the Pet hierarchy 1 file/104 KB Requirements Write a Java helper class to support XML serialization Convert To: Microsoft Word (docx) Review the UML dass diograrns provided Name your "helper" code according to the naming stendes dlisd in sless The class you will write will support the serialization/deserialization of Pet (Mammal and Recognize Text in English(U.S.) Change Reptile) hierardhy objects not include unnecessory import statements collection objects for serialzation or at deserialization. There are several import statements needed. Be sure to include all required imports However, do Follow the naming conventions discussed in class with respect to the class name and the structure for Convert NOTE There is no need to write the code for Pet, Mammal, or Reptile. If you wish to test your submission, you may bring forward the code you wrote for Lab 03 and make any adjustments required by the UML Testing your submission will alse require you to create your own test harness. TAs and tutors will have access to code to deserialize Pet objects, if you can provide an XML document containing the serialized objeds. - Create PDF Edit PDF Combine PDF Send Files Store Files Submission Submit, as on attachment to this assignment, a zipped folder containing ONLY your sourco code for the helper" class Grading The grading rubric will consider Naming of your solution Names provided for the lindividual subclass sdhema Naming of the structure dofined for collecting objects for serialization and at deserialization Import statements (points will be lost for excessive or inappropriate imports) 10:15 PM O Type here to search 窍匀 3221
UML Class Diagrams Pet Hierarchy.pdf (SECURED) - Adobe Reader File Edit View Window Help 13 68.3% |- Tools Fill 8 Sign Comment Pet (abstract Attributes dd format 2017/02/28 Conctructor accapting four (4) paramatars, aill ot cye String. Recums anefereceto a fuly formed and pet object pecies: String parent String birthday et and ger methods are assumedfurther, standard naming is assumed for these methodh (c) 2019 Terri Devis Spring 2019 10:15 PM O Type here to search 3/27/2019
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

Add a comment
Know the answer?
Add Answer to:
I need help with this Mammal: public class Mammal extends Pet{     String Vaccin...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • public class Pet {    //Declaring instance variables    private String name;    private String species;...

    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 {...

    *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; //...

    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()...

    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...

    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...

    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...

    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...

    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....

    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...

    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 =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT