Develop a Club class that serves as an adapter for a single instance variable: private Bag...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Develop a Club class that serves as an adapter for a single instance variable: private Bag<Person> members. The Club methods will work identically to the Bag methods and simply pass any arguments down to the members bag (and return any values from it as well). A main method will verify your class by adding 3 members to a club and determining if Joe Frank is a member of the club. Make sure your Person class has a properly defined equals method (as discussed in lecture)! We will also add a Student object to the club to illustrate how inheritance allows us to assign objects from a subclass to reference variables of a superclass type, and also how dynamic binding allows the Student toString method to print out the full contents of the Student in the final output. Ex: If the input is: Joe Frank Lara Allende Presley Underwood the output is: cs_club= [Joe Frank, Lara Allende, Presley Underwood] Is Joe Frank in club? true Adding student Zeus Monassus to cs_club CS_club = [Joe Frank, Lara Allende, Presley Underwood, Zeus Monassus 12345] You may wish to refer to the following Bag UML diagram: Bag <T> +getCurrentSize(): integer +isFull(): boolean +isEmpty(): boolean +add(newEntry: T): boolean +remove(): T +remove (anEntry: T): boolean +clear(): void +get FrequencyOf(anEntry: T): integer +contains (anEntry: T): boolean +toArray(): T[] +toString(): String Develop a Club class that serves as an adapter for a single instance variable: private Bag<Person> members. The Club methods will work identically to the Bag methods and simply pass any arguments down to the members bag (and return any values from it as well). A main method will verify your class by adding 3 members to a club and determining if Joe Frank is a member of the club. Make sure your Person class has a properly defined equals method (as discussed in lecture)! We will also add a Student object to the club to illustrate how inheritance allows us to assign objects from a subclass to reference variables of a superclass type, and also how dynamic binding allows the Student toString method to print out the full contents of the Student in the final output. Ex: If the input is: Joe Frank Lara Allende Presley Underwood the output is: cs_club= [Joe Frank, Lara Allende, Presley Underwood] Is Joe Frank in club? true Adding student Zeus Monassus to cs_club CS_club = [Joe Frank, Lara Allende, Presley Underwood, Zeus Monassus 12345] You may wish to refer to the following Bag UML diagram: Bag <T> +getCurrentSize(): integer +isFull(): boolean +isEmpty(): boolean +add(newEntry: T): boolean +remove(): T +remove (anEntry: T): boolean +clear(): void +get FrequencyOf(anEntry: T): integer +contains (anEntry: T): boolean +toArray(): T[] +toString(): String
Expert Answer:
Answer rating: 100% (QA)
Answer The code is as follow public class Club private Bag members public Club members new Bag Deleg... View the full answer
Related Book For
A Concise Introduction to Logic
ISBN: 978-1305958098
13th edition
Authors: Patrick J. Hurley, Lori Watson
Posted Date:
Students also viewed these programming questions
-
Discuss and explain what conflict resolution or handling methods will utilize to resolve dysfunctional conflicts within your project team.
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
What is meant by a throwaway prototype?
-
In below Exercises, use the table for A(z) (Table 2) to find the areas of the shaded regions under the standard normal curve. 1. 2. 3. 4. 1.25
-
Lowlife Company defaulted on a $250,000 loan that was due on December 31, 2011. The bank has agreed to allow Lowlife to repay the $250,000 by making a series of equal annual payments beginning on...
-
What is meant by a "potentially responsible party"?
-
Washburn University sells 3,500 season basketball tickets at $80 each for its 10-game home schedule. Give the entry to record (a) The sale of the season tickets and (b) The revenue recognized after...
-
Based on the provided information below, what would the ERD Diagram to this fictional senerio look like based off the relationship between each entity? Happy Learning (this is a fictional scenario)...
-
A gas containing 50 mol% propylene in propane is to be separated with silica gel having the equilibrium properties shown in Figure. The final products are to be 90 mol% propylene and 75 mol% propane....
-
Design an SPP that implements the following algorithm. Your design must use the least possible number of states. Your solution should consist of the processor's FSMD, its datapath and the state...
-
Describe what is meant by deferred taxes. In which situation can it become a liability and when can it become an asset?
-
What is the eventual goal of the IASB?
-
Define goodwill. How is it recorded on the balance sheet?
-
Research the joint FASB/IASB Financial Statement Presentation project. Write a short essay outlining the current status of the project and the expected changes to the financial statements.
-
How is a common-size balance sheet created?
-
Solve the initial value problem y" - 2y = 8(t-1), y(0) = 1, g(0)=0, 0t 2. Graph the solution on the indicated interval.
-
Thalina Mineral Works is one of the worlds leading producers of cultured pearls. The companys condensed statement of cash flows for the years 20182020 follows. Required Comment on Thalina Mineral...
-
[(X Z) (C B)] [(X A) (Y Z)] Determine the truth values of the following symbolized statements. Let A, B, and C be true and X, Y, and Z be false. Circle your answer.
-
Construct a complete definition by subclass for the following terms: a. Quadrilateral b. Circulating American coin
-
Not all mushrooms are edible. (M, E) Translate the following statements into symbolic form. Avoid negation signs preceding quantifiers. The predicate letters are given in parentheses.
-
In a stage of impulse-reaction turbine, steam enters with a speed of \(250 \mathrm{~m} / \mathrm{s}\) at an angle of \(30^{\circ}\) in the direction of blade motion. The mean blade speed is \(150...
-
A single row impulse turbine develops \(130 \mathrm{~kW}\) at a blade speed of \(180 \mathrm{~m} / \mathrm{s}\) using \(2 \mathrm{~kg} / \mathrm{s}\) of steam. The steam leaves the nozzle at \(400...
-
A simple impulse turbine has one ring of moving blades running at \(150 \mathrm{~m} / \mathrm{s}\). The absolute velocity of steam at exit from the stage is \(80 \mathrm{~m} / \mathrm{s}\) at an...
Study smarter with the SolutionInn App