Question
Question Consider the following class diagram. Animal # a_name: char # id: int + setData(a_name, id); void + displayData(void): void Bird - eyeColour: char +
Question
Consider the following class diagram.
Animal |
# a_name: char # id: int |
+ setData(a_name, id); void + displayData(void): void |
Bird |
- eyeColour: char |
+ Bird(a_name, id, eyeClour) + ~ Bird() + setData(a_name, id); void + setColour(eyeColour); void + displayName(void): void + displayId(void): void + displayColour(void): void |
Figure 1
You are requested to write code for the following tasks based on the class diagram given above.
Create an Animal class. The class must contain: (6 marks)
Variables
Functions
Create a Bird class. The class must contain: (18 marks)
Variables
Constructor
Destructor
Functions
Create a form that allow user to enter the Bird details. Write code to perform form validation as follows:
Use appropriate input types to capture the name, id and eye colour from the user.
Alert the user if any of the data fields are empty.
Use HTML pattern to ensure the name input must be minimum of two and maximum of ten letters.
Use HTML pattern to ensure the id input must be minimum of three and maximum of five-alphanumeric data.
(12 marks)
Create an object of Bird Class. Assign the user input to the object.
(4 marks)
Present the data in a table. Display the id, name and eye colour values of the Brid object as shown in Table 1. Apply the CSS class selector in your table design. (10 marks)
Table 1
Brid | ||
ID | Name | Eye Colour |
| | |
|
END OF QUESTION PAPER
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started