77 895
Assignments Done
Successfully Done
In August 2019

Answer to Question #11158 in Java | JSP | JSF for Ali

Question #11158
MIS 306
Managerial Applications Using Object Oriented Programming II
Assignment 2
Due Date: Monday, June 25
, 2012
 What is the output of the following code? Hint use the following as the input of the user
MISCreate the class Pet that has the following members:
 private:
a. name
b. age
c. Weight
 public
a. Add all the accessor and mutator methods.
b. Add the default constructor. That set the data members to empty string, 0, 0 respectively.
c. Add a non-default constructor that takes the name of the pet, age, and weight as parameters.
d. Add the method printInfo which prints the information of the pet.
e. Add a method compareWeight of the pet and other pet. Hint: this method takes an object otherPet.
The method returns 1 if the pet (caller) is heavier, returns -1 if the pet is lighter than the other pet,
and returns 0 if their weights are equals.
f. Add the method toString()
 Write the main application (contains the main method) that uses the class Pet as follows:
a. Declare a reference cat1 to class Pet.
b. Create an object of the class Pet and refer to it with cat1. (use the default constructor).
c. Set the data members to “Tommy”, 1, 1.5.
d. Prints the information of Tommy using printInfo() method
e. Create another object (“wilson”,2, 3.2) and refer to it with cat2.
f. Use toString() method to print the information of Wilson.
g. Compare the weight of cat2 with cat1. Let cat2 be the caller. Then prints the proper message which
tells the user which pet is heavier.
Note: make sure to do input validation: Do not accept negative numbers for any information (age
and weight), otherwise, set the value to 1.
Expert's answer
Unfortunately, your question requires a lot of work and cannot be done for free.
Submit it with all requirements as an assignment to our control panel and we'll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions