Here are some general guidelines to follow when implementing your solution to this assignment. a. Put...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Here are some general guidelines to follow when implementing your solution to this assignment. a. Put of your code into a package named "chickens". b. Use proper encapsulation. Only write accessors and mutators as needed. c. You must write unit tests for all classes and non-trivial methods, e.g. you do not need to write tests for accessors and mutators (though you may use them in your other tests). 1. Create a new Java type to represent the color of a chicken egg. Given that chicken eggs come in one of only two colors, consider the best way to create a type that may only have one of a specific list of predefined values.. 2. Create a new Java type to represent the size of a chicken egg. Chicken eggs come in one of six sizes, each of which has a minimum weight in ounces. Given a value of this new type, it should be possible to get the minimum ounces. For example, an Extra-Large chicken egg should be 27 ounces. 3. Create a new Java type to represent an egg. A chicken egg has the following attributes/methods: a. Eggs are created with a color and size. New eggs are uncracked. b. An egg may be cracked. Once cracked, an egg cannot be uncracked. c. The string representation of a chicken egg is formatted like this example: "An uncracked LARGE (240z) BROWN egg". d. Two eggs are considered equal if they are the same size and color, and are both cracked or uncracked. For example, two large, brown, uncracked eggs would be considered equal. Two peewee, white eggs would not be equal if only one of the eggs was cracked. 4. Create a new Java type to represent a chicken. A chicken has the following attributes/methods: a. A chicken has a name and always lays eggs of the same size and color. For example, a chicken named "Henny Penny" always lays large, brown eggs. b. The string representation of a chicken is formatted like this example: "Henny Penny, a that lays JUMBO WHITE eggs". c. Two chickens are considered equal if they lay eggs of the same size (regardless of the color) d. The Chicken class should include a static method to generate a chicken with a random. name, egg size, and egg color. You must select from at least 10 unique names. It is up to you what names to use. Do not worry about testing this method. 5. Create a ChickenFarm class that defines a main method with the appropriate signature. Prompt the user to enter how many chickens are on the farm. Use the static method on the Chicken class to generate the corresponding number of chickens. Print the string representation of each chicken and the first egg that it lays to standard output (see the output examples below). Note that, because the name selection for each chicken is random, you may have two or more chickens with the same name. 6. Use the drawing tool of your choice to draw a UML class diagram of the entire program. It should contain at least 5 classes or other types. Make sure to include the appropriate relationships between the types. Save your diagram as an image file in your repository and push it to GitHub along with your solution. Sample Run: Enter the number of chickens on the farm: 7 Chicken Little, a chicken that lays EXTRA LARGE WHITE eggs, laid An uncracked EXTRA LARGE (27oz.) WHITE egg. Hillary Fluff, a chicken that lays MEDIUM WHITE eggs, laid An uncracked MEDIUM (21oz.) WHITE egg. M-egg-atron, a chicken that lays EXTRA LARGE BROWN eggs, laid An uncracked EXTRA LARGE (27oz.) BROWN egg. Eggatha Christie, a chicken that lays SMALL WHITE eggs, laid An uncracked SMALL (18oz.) WHITE egg. Sal Monella, a chicken that lays LARGE BROWN eggs, laid An uncracked LARGE (24oz.) BROWN egg. M-egg-atron, a chicken that lays MEDIUM BROWN eggs, laid An uncracked MEDIUM (21oz.) BROWN egg. Optimeggs Prime, a chicken that lays JUMBO WHITE eggs, laid An uncracked JUMBO (30oz.) WHITE egg. Here are some general guidelines to follow when implementing your solution to this assignment. a. Put of your code into a package named "chickens". b. Use proper encapsulation. Only write accessors and mutators as needed. c. You must write unit tests for all classes and non-trivial methods, e.g. you do not need to write tests for accessors and mutators (though you may use them in your other tests). 1. Create a new Java type to represent the color of a chicken egg. Given that chicken eggs come in one of only two colors, consider the best way to create a type that may only have one of a specific list of predefined values.. 2. Create a new Java type to represent the size of a chicken egg. Chicken eggs come in one of six sizes, each of which has a minimum weight in ounces. Given a value of this new type, it should be possible to get the minimum ounces. For example, an Extra-Large chicken egg should be 27 ounces. 3. Create a new Java type to represent an egg. A chicken egg has the following attributes/methods: a. Eggs are created with a color and size. New eggs are uncracked. b. An egg may be cracked. Once cracked, an egg cannot be uncracked. c. The string representation of a chicken egg is formatted like this example: "An uncracked LARGE (240z) BROWN egg". d. Two eggs are considered equal if they are the same size and color, and are both cracked or uncracked. For example, two large, brown, uncracked eggs would be considered equal. Two peewee, white eggs would not be equal if only one of the eggs was cracked. 4. Create a new Java type to represent a chicken. A chicken has the following attributes/methods: a. A chicken has a name and always lays eggs of the same size and color. For example, a chicken named "Henny Penny" always lays large, brown eggs. b. The string representation of a chicken is formatted like this example: "Henny Penny, a that lays JUMBO WHITE eggs". c. Two chickens are considered equal if they lay eggs of the same size (regardless of the color) d. The Chicken class should include a static method to generate a chicken with a random. name, egg size, and egg color. You must select from at least 10 unique names. It is up to you what names to use. Do not worry about testing this method. 5. Create a ChickenFarm class that defines a main method with the appropriate signature. Prompt the user to enter how many chickens are on the farm. Use the static method on the Chicken class to generate the corresponding number of chickens. Print the string representation of each chicken and the first egg that it lays to standard output (see the output examples below). Note that, because the name selection for each chicken is random, you may have two or more chickens with the same name. 6. Use the drawing tool of your choice to draw a UML class diagram of the entire program. It should contain at least 5 classes or other types. Make sure to include the appropriate relationships between the types. Save your diagram as an image file in your repository and push it to GitHub along with your solution. Sample Run: Enter the number of chickens on the farm: 7 Chicken Little, a chicken that lays EXTRA LARGE WHITE eggs, laid An uncracked EXTRA LARGE (27oz.) WHITE egg. Hillary Fluff, a chicken that lays MEDIUM WHITE eggs, laid An uncracked MEDIUM (21oz.) WHITE egg. M-egg-atron, a chicken that lays EXTRA LARGE BROWN eggs, laid An uncracked EXTRA LARGE (27oz.) BROWN egg. Eggatha Christie, a chicken that lays SMALL WHITE eggs, laid An uncracked SMALL (18oz.) WHITE egg. Sal Monella, a chicken that lays LARGE BROWN eggs, laid An uncracked LARGE (24oz.) BROWN egg. M-egg-atron, a chicken that lays MEDIUM BROWN eggs, laid An uncracked MEDIUM (21oz.) BROWN egg. Optimeggs Prime, a chicken that lays JUMBO WHITE eggs, laid An uncracked JUMBO (30oz.) WHITE egg.
Expert Answer:
Answer rating: 100% (QA)
1 package chickens public class Chicken private String name private int age private EggColor egg... 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
-
Show all the workings and explain the position of the directional vector for your company in a specific quadrant and recommend which strategy JP Morgan should pursue, given their position on the...
-
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...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Classify each of the following random variables as either continuous or discrete: a. The survival time of a cancer patient after receiving a new treatment for cancer b. The number of ticks found on a...
-
If an alarm clock is placed in a good vacuum and then activated, no sound is heard. Explain.
-
Current Attempt in Progress These are selected account balances on December 31, 2025. Land $195000 Land (held for future use) 292500 Buildings 1560000 Inventory 390000 Equipment 877500 Furniture...
-
List and discuss the major information security and privacy threats to organizations.
-
Little Switzerland Brewing Company was incorporated on January 28. On February 18, Ellison and Oxley were made directors of the company after they purchased some stock. Then, on September 25, Ellison...
-
Given data ) File name: 'BiaxData.txt' 0.105376913,0.608644075,-0,-0,-0,-0 0.115333948,0.611257461,0.000330284596940253,-0.000150127745024663,0.000112709327733994,4.40176303206957e-05...
-
Mahjong, Inc., has identified the following two mutually exclusive projects: Year ______Cash Flow (A) ________Cash Flow (B) 0 ................. -$43,000 ................... -$43,000 1...
-
A scientist has two solutions, which she has labeled solution A and Solution B. Each contains salt. She knows that Solution A is 65% salt and Solution B is 90% salt. She wants to obtain 140 ounces of...
-
Required to read minimum of THREE ( 3 ) ( 3 ) journals, articles or research papers and write a review paper about Information security in organisation . . In the review paper, should include:...
-
2. (50pts) McDonald-Pelz wants to determine its oil trading strategy for the next two weeks (10 business days). The following table summarizes the estimated purchase prices (the Ask price, per...
-
Using the data in the adjusted trial balance, prepare an income statement in good form for Benco?(just for this year, 20X3).? Assume the "loss on sale of warehouse" was actually a loss on the sale of...
-
redo incorrect boxes pls S Safari File Edit View History Bookmarks Window Help lobble Cash Short-term investments Accounts receivable Interest receivable Supplies Prepaid expenses Land Required...
-
Draw and design, your own version of a combined infant and toddler classroom environment. Explain your classroom and the contents held within each area. You should list minimally eight items in each...
-
SM, JYP, and YG share P/L ration of 5:3:2. The following balances are obtained prior to partnership liquidation: Capital balances Loan balances SM 60,000 22,500 JYP 45,000 15,000 January - 7,500...
-
Write out the formula for the total costs of carrying and ordering inventory, and then use the formula to derive the EOQ model. Andria Mullins, financial manager of Webster Electronics, has been...
-
Cedar Corporation has an S corporation election in effect. During the 2012 calendar tax year, the corporation had ordinary taxable income of $200,000, and on January 15, 2012, the corporation paid...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Janie graduates from high school in 2012 and enrolls in college in the fall. Her parents pay $4,000 for her tuition and fees. a. Assuming Janie's parents have AGI of $170,000, what is the American...
-
A response to the IASB's Exposure Draft 2009/5 Fair Value Measurements, stated: In practical terms we doubt that an asset measured on any other basis than its intended use will provide more useful...
-
Palm Ltd acquired a business that used a large number of assets that worked in combination to produce a product saleable in offshore markets. The assets of the business include a computer program...
-
In a business combination, Skyentist Ltd acquired inventory that is sold in three different markets: Market A, Market \(B\) and Market C. Some information gathered in relation to these three markets...
Study smarter with the SolutionInn App