Write a Java program containing two classes: Dog and a driver class Kennel. The Dog dlass consists of the following information: • An integer age. • A string name. A boolean hairLength representing hair length; true indicates short hair. • An enumeration representing the type of tail (LONG, SHORT, NONE). The Dog class consists of the following methods. • A default constructor. • A constructor that takes a name as argument. If the given name contains non-alphabetic characters, initialize to Wolfy. • A method private boolean validName (String) that returns true / false whether the given name contains non-alphabetic characters. Each constructor should initialize all attributes to reasonable initial values.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question
In java
Microsoft Word - Lab 10.docx
CS101: Lab #10
Writing Classes I
Write a Java program containing two classes: Dog and a driver class Kennel.
The Dog class consists of the following information:
An integer age.
• A string name.
• A boolean hairLength representing hair length; true indicates short hair.
An enumeration representing the type of tail (1ONG, SHORT, NONE).
The Dog class consists of the following methods.
• A default constructor.
• A constructor that takes a name as argument. If the given name contains non-alphabetic
characters, initialize to Wolfy.
A method private boolean validName (String) that returns true / false whether
the given name contains non-alphabetic characters.
Each constructor should initialize all attributes to reasonable initial values.
The main method in the Kennel class should create several dogs with each constructor and output
their instance data using tostring. You must use the defoult constructor once. You must use the
overloaded constructor twice at least, once with a name that contains only alphabetic characters, once
with a name that contains one or more non-alphabetic characters.
...
Transcribed Image Text:Microsoft Word - Lab 10.docx CS101: Lab #10 Writing Classes I Write a Java program containing two classes: Dog and a driver class Kennel. The Dog class consists of the following information: An integer age. • A string name. • A boolean hairLength representing hair length; true indicates short hair. An enumeration representing the type of tail (1ONG, SHORT, NONE). The Dog class consists of the following methods. • A default constructor. • A constructor that takes a name as argument. If the given name contains non-alphabetic characters, initialize to Wolfy. A method private boolean validName (String) that returns true / false whether the given name contains non-alphabetic characters. Each constructor should initialize all attributes to reasonable initial values. The main method in the Kennel class should create several dogs with each constructor and output their instance data using tostring. You must use the defoult constructor once. You must use the overloaded constructor twice at least, once with a name that contains only alphabetic characters, once with a name that contains one or more non-alphabetic characters. ...
Expert Solution
steps

Step by step

Solved in 7 steps with 5 images

Blurred answer
Knowledge Booster
Developing computer interface
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
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