Question
Description:
A survey was carried out to record the ages of dogs in a given town. The records are made in the format;
14571259254.83
- where the number 14571259254 represents 11 age entries of the dogs in the town and the number 83 captures 2 entries representing the number of male and female dogs in that town.
- In the entries made, some are valid and others are invalid.
- An entry is invalid if the number of age entries (number of digits before decimal point) is not equal to the sum of male and female number entries (sum of digits after decimal point).
Tasks:
- Return the number of entries made
- Extract the female and male entries (the decimal value) and returns it as an integer
- Find the total of the male and female dog entries (sum of digits of integer value)
- Determine if an entry is valid or invalid and returns a boolean (0 or 1).
Write a function for each task above
Sample Cases:
-
123.12 : This is a valid record in which 3 age entries were made.
The entries 1 and 2 represent the number of male and female dogs respectively in the records.
The decimal value extracted as an integer is 12.
-
13478.49 : This is a invalid record in which 5 age entries were made.
The entries 4 and 9 represent the number of male and female dogs respectively in the records.
The decimal value extracted as an integer is 49.
Deadline
29th November 2022, 11:59 PM.
Guidelines
- This is a group assignment
- Maximum group size is 5
- Decide your group members before joining the assignment and create a group on the page afterwards.
- Groups already made, remain intact and shall be used throughout all assignments.
- To make adjustments to groups, reach out to your respective TA.
- One member is needed to make a group and the rest are required to join that group.
- Uniquely name your group (Advised to use the name of one group member to avoid repetition of names)
- Only one member is needed to submit on behalf of the group, however, all members have the ability to submit.
Assignment Registration
- Join the assignment page;