For the 'The Chicken class' on the app intelliJ in java.  The Chicken class must: • Define three fields called exactly name, pricePerKilo and inStock. The name field must be of type String, the pricePerKilo must be of type int (representing the cost per kilo in pence) and the inStock field must be of type boolean. • Initialise the three fields via a constructor that takes exactly two parameters. The first parameter must be of type String and the second parameter must be of type int. The first parameter must initialise the name field and the second must initialise the pricePerKilo field. The constructor must set the inStock field to true for all Chicken objects. There must be no parameter to the constructor for the inStock field. • Define getters for all three fields using the standard getter naming convention. In particular, note that the getter for the inStock field must be called getInStock rather than isInStock. • Define setters for the pricePerKilo and inStock fields using the standard setter naming convention. Each must take a parameter of the appropriate type. There must be no setter for the name field. • Define a method called getDetails that returns a String containing the name and price per Kilogram. For instance, if the name is "Wings" and the price per Kilogram is 1000 (pence) the getDetails method would return the String: "Wings costs 1000 pence per Kilo". You must ensure that the format of the String returned exactly matches this example.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

For the 'The Chicken class' on the app intelliJ in java. 
The Chicken class must:
• Define three fields called exactly name, pricePerKilo and inStock. The name field must be of type String, the pricePerKilo must be of type int (representing the cost per kilo in pence) and the inStock field must be of type boolean.
• Initialise the three fields via a constructor that takes exactly two parameters. The first parameter must be of type String and the second parameter must be of type int. The first parameter must initialise the name field and the second must initialise the pricePerKilo field. The constructor must set the inStock field to true for all Chicken objects. There must be no parameter to the constructor for the inStock field.
• Define getters for all three fields using the standard getter naming convention. In particular, note that the getter for the inStock field must be called getInStock rather than isInStock.
• Define setters for the pricePerKilo and inStock fields using the standard setter naming convention. Each must take a parameter of the appropriate type. There must be no setter for the name field.
• Define a method called getDetails that returns a String containing the name and price per Kilogram. For instance, if the name is "Wings" and the price per Kilogram is 1000 (pence) the getDetails method would return the String: "Wings costs 1000 pence per Kilo". You must ensure that the format of the String returned exactly matches this example. 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,