*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 );
} // end full constructor
/*
* Set methods
*/
public final void setName( String aName )
{
name = aName;
} // end setName
public final void setSpecies( String aSpecies )
{
species = aSpecies;
} // end setSpecies
public final void setParent( String aParent )
{
parent = aParent;
} // end setParent
public final void setBirthday( String aBDay )
{
birthday = aBDay;
} // end setName
/*
* Get methods
*/
public final String getName( )
{
return name;
} // end getName
public final String getSpecies( )
{
return species;
} // end getSpecies
public final String getParent( )
{
return parent;
} // end getParent
public final String getBirthday( )
{
return birthday;
} // end getBirthday
/*
* toString method
*/
public String toString( )
{
return String.format( "%s, whose fur-parent is %s, is a(n) %s born on %s.%n",
getName( ),
getParent( ),
getSpecies( ),
getBirthday( ) );
} // end toString
} // end Pet
ArrayMethods.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 );
} // end full constructor
/*
* Set methods
*/
public final void setName( String aName )
{
name = aName;
} // end setName
public final void setSpecies( String aSpecies )
{
species = aSpecies;
} // end setSpecies
public final void setParent( String aParent )
{
parent = aParent;
} // end setParent
public final void setBirthday( String aBDay )
{
birthday = aBDay;
} // end setName
/*
* Get methods
*/
public final String getName( )
{
return name;
} // end getName
public final String getSpecies( )
{
return species;
} // end getSpecies
public final String getParent( )
{
return parent;
} // end getParent
public final String getBirthday( )
{
return birthday;
} // end getBirthday
/*
* toString method
*/
public String toString( )
{
return String.format( "%s, whose fur-parent is %s, is a(n) %s born on %s.%n",
getName( ),
getParent( ),
getSpecies( ),
getBirthday( ) );
} // end toString
} // end Pet

public static<T> void printRange(T data[], int start, int end) {
if(start < 0 || start > end || end >= data.length) {
System.out.println("Invalid parameters passed.");
} else {
for(int i=start; i<=end; i++) {
System.out.println(data[i]);
}
}
}
public static<T> T returnItem(T data[], int index) {
return data[index];
}
you have shared the same pet class instead of arraymethods class.. but still the given methods above should fit in ArrayMethods without any issues.
*PLEASE HELP ASAP* Pet.java /* * Class Pet * * * */ public class Pet {...
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; ...
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...
How to solve this problem?
Consider the following class : public class Store Public final double SALES TAX_RATE = 0.063B private String name; public Store(String newName) setName ( newName); public String getName () { return name; public void setName (String newName) { name = newName; public String toString() return "name: “ + name; Write a class encapsulating a web store, which inherits from Store. A web store has the following additional attributes: an Internet Address and the programming language in...
Inheritance and Polymorphism (use Pet.java) You are given a class named Pet.java. Create two child classes named Cat.java and Dog.java. Cat.java should add attributes for color and breed. Dog.java should add attributes for breed and size (use String for small, medium, large). Add appropriate constructors, getter/setter methods and toString() methods. In a separate file named PetDriver.java, create a main. In the main, create an ArrayList of Pet. Add an instance of Cat and an instance of Dog to the ArrayList....
4. Command pattern //class Stock public class Stock { private String name; private double price; public Product(String name, double price) { this.name = name; this.price = price; } public void buy(int quantity){ System.out.println(“BOUGHT: “ + quantity + “x “ + this); } public void sell(int quantity){ System.out.println(“SOLD: “ + quantity + “x “ + this); } public String toString() { return “Product [name=” + name + “, price=” + price + “]”; } } a. Create two command classes that...
LAB: Pet information (derived classes)The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dogBreed. Complete main() to:create a generic pet and print information using printInfo().create a Dog pet, use printInfo() to print information, and add a statement to print the dog's breed using the getBreed() method.Ex. If the input is:Dobby 2 Kreacher 3 German Schnauzerthe output is:Pet Information: Name: Dobby Age: 2 Pet Information: Name: Kreacher Age: 3 Breed: German SchnauzerPetInformation.javaimport java.util.Scanner; public class PetInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Pet myPet = new Pet(); Dog myDog = new Dog(); String petName, dogName, dogBreed; int petAge, dogAge; petName = scnr.nextLine(); petAge = scnr.nextInt(); scnr.nextLine();...
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...
import java.util.Scanner; public class StudentClient { public static void main(String[] args) { Student s1 = new Student(); Student s2 = new Student("Smith", "123-45-6789", 3.2); Student s3 = new Student("Jones", "987-65-4321", 3.7); System.out.println("The name of student #1 is "); System.out.println("The social security number of student #1 is " + s1.toString()); System.out.println("Student #2 is " + s2); System.out.println("the name of student #3 is " + s3.getName()); System.out.println("The social security number...
java questions: 1. Explain the difference between a deep and a shallow copy. 2. Given the below classes: public class Date { private String month; private String day; private String year; public Date(String month, String day, String year) { this.month = month; this.day = day; this.year = year; } public String getMonth() { return month; } public String getDay() { return day; } public String...
Java help: 1.1) Create a class TA that extends class Student. 1.2) Add a variable to the TA class to represent the course the student is TA'ing. 1.3) Provide a constructor for the class so the code in the PeopleFactory will work as provided. 1.4) Provide a toString() method for the TA class so that TA's will output as shown in the sample code. Provide a class Staff so that you can un-comment the lines of code in the PeopleFactory class that...