Write a python program that computes the zakat, obligatory charity, on camels. The program asks the user to input the number of camels, and then the zakat is calculated based on the following table:   Rule for computing the zakat of 121 camels or more: You need to find the combinations of 40 camels and 50 camels that will minimize the number of “left over” camels not being “counted” in the zakat. For example, for 130 camels, we have (2*40) + (1*50)=130, with no left overs, and hence, the zakat consists of 2 bint Laboun and 1 Hiqqah. When we have 145 camels, we have the following scenarios: 1. (140) + (250) = 140 with 5 camels left over, 2. (240) + (150) = 130 with 15 camels left over, 3. (340) + (050) = 120 with 25 camels left over. Therefore, in this case the zakat is 1 bint Laboun and 2 Hiqqah, following the first scenario.   Important Notes: Make sure that the input value is a positive integer. If not, the program must print the following message: Wrong input. Number should be an integer greater than 0. and continue reading input from the user, until a valid positive integer is entered. You need to use functions to develop this code. Make sure that the functions are meaningful and break your program in a logical manner. Your main program shall run by calling function main. The main function shall only consist of calls to other functions, and the print statements of the results. Your main function will specify what your program does. The details of the how are in the implementation of these functions. Global variables are not allowed. You should pass parameters to functions and receive results from them. Sample Run 1 Enter the number of camels: 12.0 Wrong input. Number should be an integer greater than 0. Enter the number of camels: -5 Wrong input. Number should be an integer greater than 0. Enter the number of camels: five Wrong input. Number should be an integer greater than 0. Enter the number of camels: 12 For 12 camels, the zakat consists of 2 sheep Sample Run 2 Enter the number of camels: 3 For 3 camels, there is no Zakat Sample Run 3 Enter the number of camels: 17 For 17 camels, the zakat consists of 3 sheep Sample Run 4 Enter the number of camels: 30 For 30 camels, the zakat consists of 1 bint Makhadh Sample Run 5 Enter the number of camels: 40 For 40 camels, the zakat consists of 1 bint Laboun Sample Run 6 Enter the number of camels: 50 For 50 camels, the zakat consists of 1 Hiqqah Sample Run 7 Enter the number of camels: 71 For 71 camels, the zakat consists of 1 Jathaah Sample Run 8 Enter the number of camels: 90 For 90 camels, the zakat consists of 2 bint Laboun Sample Run 9 Enter the number of camels: 92 For 92 camels, the zakat consists of 2 Hiqqah Sample Run 10 Enter the number of camels: 131 For 131 camels, the zakat consists of 2 bint Laboun ; 1 Hiqqah Sample Run 11 Enter the number of camels: 152 For 152 camels, the zakat consists of 0 bint Laboun ; 3 Hiqqah Sample Run 12 Enter the number of camels: 122 For 122 camels, the zakat consists of 3 bint Laboun ; 0 Hiqqah

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a python program that computes the zakat, obligatory charity, on camels. The program asks the user to input the number of camels, and then the zakat is calculated based on the following table:

 

Rule for computing the zakat of 121 camels or more:

You need to find the combinations of 40 camels and 50 camels that will minimize the number of “left over” camels not being “counted” in the zakat. For example, for 130 camels, we have (2*40) + (1*50)=130, with no left overs, and hence, the zakat consists of 2 bint Laboun and 1 Hiqqah. When we have 145 camels, we have the following scenarios: 1. (140) + (250) = 140 with 5 camels left over, 2. (240) + (150) = 130 with 15 camels left over, 3. (340) + (050) = 120 with 25 camels left over. Therefore, in this case the zakat is 1 bint Laboun and 2 Hiqqah, following the first scenario.

 

Important Notes:

  • Make sure that the input value is a positive integer. If not, the program must print the following message: Wrong input. Number should be an integer greater than 0. and continue reading input from the user, until a valid positive integer is entered.
  • You need to use functions to develop this code. Make sure that the functions are meaningful and break your program in a logical manner. Your main program shall run by calling function main.
  • The main function shall only consist of calls to other functions, and the print statements of the results. Your main function will specify what your program does. The details of the how are in the implementation of these functions.
  • Global variables are not allowed. You should pass parameters to functions and receive results from them.

Sample Run 1

Enter the number of camels: 12.0
Wrong input. Number should be an integer greater than 0.
Enter the number of camels: -5
Wrong input. Number should be an integer greater than 0.
Enter the number of camels: five
Wrong input. Number should be an integer greater than 0.
Enter the number of camels: 12
For 12 camels, the zakat consists of 2 sheep

Sample Run 2

Enter the number of camels: 3
For 3 camels, there is no Zakat

Sample Run 3

Enter the number of camels: 17
For 17 camels, the zakat consists of 3 sheep

Sample Run 4

Enter the number of camels: 30
For 30 camels, the zakat consists of 1 bint Makhadh

Sample Run 5

Enter the number of camels: 40
For 40 camels, the zakat consists of 1 bint Laboun

Sample Run 6

Enter the number of camels: 50
For 50 camels, the zakat consists of 1 Hiqqah

Sample Run 7

Enter the number of camels: 71
For 71 camels, the zakat consists of 1 Jathaah

Sample Run 8

Enter the number of camels: 90
For 90 camels, the zakat consists of 2 bint Laboun

Sample Run 9

Enter the number of camels: 92
For 92 camels, the zakat consists of 2 Hiqqah

Sample Run 10

Enter the number of camels: 131
For 131 camels, the zakat consists of 2 bint Laboun ; 1 Hiqqah

Sample Run 11

Enter the number of camels: 152
For 152 camels, the zakat consists of 0 bint Laboun ; 3 Hiqqah

Sample Run 12

Enter the number of camels: 122
For 122 camels, the zakat consists of 3 bint Laboun ; 0 Hiqqah

The number of camels ranging
Zakat Amount
from
to
1
4
No zakat
5
24
1 sheep (šL#) for every 5 camels
25
35
1 bint Makhadh (ialis Cij): Female camel greater than 1 year old, but less than 2 years old.
36
45
1 bint Laboun (is C): Female camel greater than 2 years old, but less than 3
years
old.
46
60
1 Hiqqah (): Female camel greater than 3 years old, but less than 4 years old.
61
75
1 Jathaah (Aéiá): Female camel greater than 4 years old.
76
90
2 bint Laboun
91
120
2 Hiqqah
121
No limit
1 bint Laboun for every 40 camels and 1 Hiqqah for every 50 camels according to the rule below
Transcribed Image Text:The number of camels ranging Zakat Amount from to 1 4 No zakat 5 24 1 sheep (šL#) for every 5 camels 25 35 1 bint Makhadh (ialis Cij): Female camel greater than 1 year old, but less than 2 years old. 36 45 1 bint Laboun (is C): Female camel greater than 2 years old, but less than 3 years old. 46 60 1 Hiqqah (): Female camel greater than 3 years old, but less than 4 years old. 61 75 1 Jathaah (Aéiá): Female camel greater than 4 years old. 76 90 2 bint Laboun 91 120 2 Hiqqah 121 No limit 1 bint Laboun for every 40 camels and 1 Hiqqah for every 50 camels according to the rule below
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education