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.
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 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...
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...
You lend $400,000 to your friend for seven years. According to the agreement, your friend has...
You lend $400,000 to your friend for seven years. According to the agreement, your friend has to repay $89,000 annually for the first four years with a fixed interest rate of 15% compounded annually. Your friend tries to bargain for a 13% charged for the remaining periods. What should be the annual repayment for the last three years?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT