Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here's the provided class; Question 3: Wool Farming (40 points) For this question, you will write several classes, and then create and use instances of

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Here's the provided class;

image text in transcribed

Question 3: Wool Farming (40 points) For this question, you will write several classes, and then create and use instances of those classes in order to simulate a sheep farm. (a) (7 points) Write a class Dog. A Dog has the following private attributes A string name breed. A String The dog class also contains the following public methods: A constructor that takes as input the name and breed of the dog getName which returns the name of the dog A herd method that returns the number of sheep the dog can herd. This will depend on the type of dog doing the herding. All dogs of the Collie breed can herd 20 sheep, while all Shepherds can herd 25 sheep. Kelpies and Teruvens can each herd up to 30 sheep. All other breeds of dogs can herd 10 sheep. For example, a Dog of breed White Shepherd or belgian shepherd, or just shepherd would be able to herd 25 sheep Hint: Think about you can use the toLowerCase C) and contains() methods to do this check in a case-insensitive manner. (b) (8 points) Write a class Sheep. A Sheep has the following private attributes A string name An int age A boolean hasWool

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+ What are the information and consultation requirements?

Answered: 1 week ago

Question

=+ Should the MNE belong (why, why not)?

Answered: 1 week ago