A: Creating a Class [10 marks] Write a Java class called Person. Each person will have...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A: Creating a Class [10 marks] Write a Java class called Person. Each person will have a name (String), a favourite kind of pet (String), and a list of the kind of every pet that this person has ever had (array of Strings). The pet list may contain the same kind of pet multiple times. Include a constructor that has three input parameters (for name, favourite kind of pet and pet list) and sets the initial state for the object. The constructor must make a new array for the list of pets and copy the data from the input array to this new one. Write a superHappy () method that returns true if more than 1/2 of all the pets that this person has had is their favourite kind of pet and returns false otherwise. Do not use information hiding/encapsulation for this class. Make everything accessible. A: Creating a Class [10 marks] Write a Java class called Person. Each person will have a name (String), a favourite kind of pet (String), and a list of the kind of every pet that this person has ever had (array of Strings). The pet list may contain the same kind of pet multiple times. Include a constructor that has three input parameters (for name, favourite kind of pet and pet list) and sets the initial state for the object. The constructor must make a new array for the list of pets and copy the data from the input array to this new one. Write a superHappy () method that returns true if more than 1/2 of all the pets that this person has had is their favourite kind of pet and returns false otherwise. Do not use information hiding/encapsulation for this class. Make everything accessible.
Expert Answer:
Answer rating: 100% (QA)
The Java class for the given requirements public class Person public String name public String favor... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
aj b) If the magnitude of the force F is 700 N, what is the value of the internal moment at point A in N.m? d) 0.5 m 540 180 210 A 0.8 m 240 Bo birak F A
-
If a driver makes contact with a steering wheel during a 35-mph crash, she comes to rest in about t = 15 ms. If, during an identical crash, the driver makes contact with an air bag, she comes to rest...
-
What is bid rigging?
-
What do you know about the mathematical value of the annual worth of a project under each of the following conditions? a. The present worth of the project is greater than 0 . b. The present worth of...
-
Wiemers Corporations comparative balance sheets are presented below. Wiemerss 2014 income statement included net sales of $100,000, cost of goods sold of $60,000, and net income of $15,000....
-
Display Oracle database employee last_name and salary for employee_ids between 100and 102. Include a third column that divides each salary by 1.55 and rounds the result two decimal places.
-
You are the Owners project manager on an electrical upgrade project. Existing overhead power lines are being buried in a duct bank to hide them from view in an area of the town that is being...
-
YOUR CLIENT HAS BEEN USING A MANUAL ACCOUNTING SYSTEM WITH A PROPER AND EFFECTIVE SYSTEM OF INTERNAL CONTROL. THEY ARE CONSIDERING A CONVERSION TO AN AUTOMATED ACCOUNTING INFORMATION SYSTEM FOR...
-
(a) Construct a deterministic finite-sate automaton that recognizes the set of bit strings that have neither two consecutive Os nor two consecutive 1s. (b) Find the language recognized by the...
-
Overloaded Sorting. In class, we have primarily used integer arrays as examples when demonstrating how to sort values. However, we can sort arrays made of other primitive datatypes as well. You need...
-
Select one of the following entry strategies: Export/Import Business Licensing Franchising Strategic Alliances Joint Ventures Foreign Acquisitions Wholly Owned Foreign Subsidiaries Provide a...
-
A benchmark is a typical program which accurately predicts the performance of all other applications. [5 marks] (c) Complex instruction set computers minimise the semantic gap between machine code...
-
What is institutional isomorphism in sociology and how does it affect the individual workers?
-
Continue writing the Business Functions Connections paper. For this week, discuss how Human Resources, specifically Motivating the Workforce, is interrelated and connected to the various business...
-
The Home Depot is the leading retailer in the home improvement industry and one of the 10largest retailers in the United States. The company included the following on its January 29, 2012, balance...
-
Bill and Guilda each own 50 percent of the stock of Radiata Corporation, an S corporation. Guilda's basis in her stock is $25,000. On July 31, 2012, Bill sells his stock, with a basis of $40,000, to...
-
Lisa Sizemore, a taxpayer in the 10-15 percent tax bracket, purchased stock as an investment on July 11, 2011. She sold the stock on July 9, 2012, 2 days before qualifying for the long-term holding...
-
Tom has a successful business with $100,000 of income in 2012. He purchases one new asset in 2012, a new machine which is 7-year MACRS property and costs $25,000. If you are Tom's tax advisor, how...
-
Because of the negative incentive effect that taxes have on goods with elastic supply, in the late 1980s Margaret Thatcher (then prime minister of Great Britain) changed the property tax to a poll...
-
Many of the buildings in Paris have Mansard roofs, such as those shown in the photograph on page 147. a. What property tax structure would bring this about? b. Could you imagine a change in the...
-
On September 29, 2008, the stock market fell almost 7%. How can we reconcile these kinds of huge losses in the stock market with the efficient market hypothesis?
Study smarter with the SolutionInn App