Question

In: Computer Science

Your friend Victoria runs a parrot rescue organization and has asked you create an app that...

  1. Your friend Victoria runs a parrot rescue organization and has asked you create an app that will help her keep track of the parrots that have been in the rescue. For each parrot, Victoria needs to know the parrot’s name (pName), type of parrot (pType), age (pAge) and whether it has been adopted (isAdopted). She needs to be able to feed the parrot and bathe the parrot. You will write two classes for this app: the Parrot class and ParrotDriver (main) class.

Create your two classes, named as above. The Parrot class must include:

  • Appropriate instance variables
  • 1 constructor that receives data for the above four instance variables
  • 2 methods, feeding and bathing the parrot
  • 1 setter method and 1 getter method for pName (assume the other setters and getters are already created)

You will then need to create an object (just make up some data), feed the parrot and print the parrot’s name and whether it has been fed. (hint: remember what you need to do in Main to accomplish this).

Solutions

Expert Solution

class Parrot{
        private String pName;
        private String pType;
        private int age;
        private boolean isAdopted;
        public Parrot(String aPName, String aPType, int aAge, boolean aIsAdopted) {
                super();
                pName = aPName;
                pType = aPType;
                age = aAge;
                isAdopted = aIsAdopted;
        }
        public String getpName() {
                return pName;
        }
        public void setpName(String aPName) {
                pName = aPName;
        }
        public void feed() {
                System.out.println("Feeding Parrot");
        }
        public void bathe() {
                System.out.println("Bathing Parrot");
        }
}
public class ParrotDriver {
        public static void main(String[] args) {
                Parrot p = new Parrot("Jake", "LoveBird", 12, true);
                p.feed();
                System.out.println(p.getpName());
        }
}

Related Solutions

You are volunteering for a local children's softball league. They asked you to create an app...
You are volunteering for a local children's softball league. They asked you to create an app or a Web application to help in their operations. You decide to create a database. The league consists of several teams. Players are assigned to teams at the start of the season. It also collects parents' contact information, and charges season and optional equipment rental fees. League volunteers include officials, referees, coaches, and first aid attendants. Parents also volunteer to help at individual practices...
You and your friend Olivia are both volunteers at a cat rescue. The shelter supervisor asks...
You and your friend Olivia are both volunteers at a cat rescue. The shelter supervisor asks the two of you to clean out kennels and haul bags of cat food from the donation area to storage. You know from your last time volunteering that you can clean out 10 kennels in an hour or move 5 bags of cat food. Olivia can clean out 6 kennels in an hour or move 6 bags of cat food. Olivia suggests that you...
The executive director of Mutt Rescue (MR) animal shelter has asked you to prepare an annual...
The executive director of Mutt Rescue (MR) animal shelter has asked you to prepare an annual budget for the coming fiscal year as well as a flexible budget based on a 5 percent increase in the number of dogs taken into MR’s shelter during the year. She has given you the following guidelines. Number of dogs rescued and placed by MR: 800 Average length of stay for a dog in the shelter: 12 days Daily cost of feeding one dog:...
You work for an organization in Nova Scotia and your manager, Jessica Boyer, has asked you...
You work for an organization in Nova Scotia and your manager, Jessica Boyer, has asked you to prepare a memo detailing the remittance responsibilities and legal consequences of non-compliance with statutory remittance requirements. studing material : Employers are responsible for registering and maintaining a payroll program account with the Canada Revenue Agency. The employer will remit the statutory deductions withheld from the employees’ remuneration for Canada Pension Plan (CPP) contributions, Employment Insurance (EI) premiums, and federal and non-Québec provincial income...
You work for an organization in Nova Scotia and your manager, Jessica Boyer, has asked you...
You work for an organization in Nova Scotia and your manager, Jessica Boyer, has asked you to prepare a memo detailing the remittance responsibilities and legal consequences of non-compliance with statutory remittance requirements.
Assuming that you are IT manger in your organization and your president asked you to illustrate...
Assuming that you are IT manger in your organization and your president asked you to illustrate and discuss the importance of systems integration that will be achieved by adopting ERP systems. Your answer should include the necessary steps involved, expected benefits, as well as the roles of both ERP system and management in system integration.
your friend has a food truck business and has asked your advice on using social media...
your friend has a food truck business and has asked your advice on using social media to promote his business. What direction would you offer? Thoroughly explain which social media tools(at least 3) he should use and how?
A friend of yours has asked for your assistance in determining the gross profit for her...
A friend of yours has asked for your assistance in determining the gross profit for her new promotions company that distributes branded refillable water bottles to her only client. The agreed upon selling price to her customer for the entire year was $5.00 per unit. Her beginning and ending inventory were 500 units and there was no inventory shrinkage or returns. Assume the starting inventory cost per unit was $2.00. She uses a periodic inventory method. Her purchases were as...
Your friend Sam has been asked to prepare appetizers for the university reception. She has an...
Your friend Sam has been asked to prepare appetizers for the university reception. She has an unlimited amount of ingredients and six hours in which to prepare them. Sam can make 400 mini-sandwiches or 200 servings of melon slices topped with smoked salmon and a dab of sauce per hour. Sam's opportunity cost of making one mini-sandwich is   (Click to select)   2 melon appetizers   0.5 melon appetizer  . Sam's opportunity cost of making one melon appetizer is   (Click to select)   2 mini-sandwiches   0.5 mini-sandwich  . Suppose the reception...
Your organization has asked you to estimate the proportion of current employees who expect to retire...
Your organization has asked you to estimate the proportion of current employees who expect to retire by the age of 65. Develop an appropriate sampling frame and sampling approach to facilitate this task. Note: Your sample must be random. Outline the data collection process you would employ. Additionally, provide a substantive response to the following questions: What considerations need to be made when defining and collecting information from a sample? What problems might you encounter and how frequently might they...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT