Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone pleas can someone kindly help me with the two questions posted above i am having hard time solving the two questions. Apologise in

Can someone pleas
image text in transcribed
can someone kindly help me with the two questions posted above i am having hard time solving the two questions.
Apologise in advance for posting 2 questions running out of space here
Thank you for understanding
1. Label each method with its type. (constructor, accessor, mutator, facilitator) public class Animal cewe private String noisej private Strint type Methy public Animal () { noise - "now" type = "cat": 2. Fill in the blanks to create a "person object. public class //Instance variables private String name; private int age; //Constructor I: Assign defaults public O age - 15: 3 //Constructor II: Assign in values public (String n, int a) - public Animal (String , Strings) noises type - az //Accessor: converts both variables to string public String toString return ) public String toString() [ return "the" type noise says .. //Accessor: returns instance variables public String getName() { return public String getSound return noise; public int getAge() { return > public String BetAnimal ( return type: public void set Sound (Strings) { noise - 5 //Mutator: changes instance variables public void setName (String n) { . ) public void setAge (int a) { a; 3 public void setAnimal (Stringa) type=3 To public boolean equals (Animal tuo) if (two.getAninal ().equals (type) & togetsound ().equals (noise)) return true; else return false; //Facilitator: If equal, return true public boolean equals (Person two) { if (two get ().equals (name) 88 two. get () - age) return true; else return false; public int compareTo (Animal two) 1f (tro.equals(this)) return; else if (to.getAnimal ().compare to (type) > e) return 1; elso return -13 //Facilitator: Compare on the basis of name public int compareTo (Person two) { if (two.equals (this)) return ; else if (two.getName().compareTo (nane) >- ) return 1; else return -1; 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions

Question

Define procedural justice. How does that relate to unions?

Answered: 1 week ago