A man decided to give 12 pieces of candy to each of the girls in his town and 8 pieces of candy to each of the boys. Of the 612 children in his town, only half the girls and three quarters of the boys were allowed to take the candy. How many pieces of candy did the gentleman have to buy?

Boys = b, Girls = 612 - b

12 * (612-b)/2 + 8 * 3/4b = ?

However, with the data given, I don't know how to find b.

To solve this problem, we need to determine the number of girls and boys who were allowed to take the candy, and then calculate the total number of candy pieces needed.

Let's break down the problem into steps:

Step 1: Find the number of girls who were allowed to take the candy.
Since only half of the girls were allowed, we take half of the total number of girls:
Number of girls allowed = (1/2) × Total number of girls

Step 2: Find the number of boys who were allowed to take the candy.
Since three quarters of the boys were allowed, we take three quarters of the total number of boys:
Number of boys allowed = (3/4) × Total number of boys

Step 3: Calculate the total number of candy pieces needed.
The total number of candy pieces needed will be the sum of the candy given to the girls and the candy given to the boys:
Total candy pieces needed = (Number of girls allowed × 12) + (Number of boys allowed × 8)

Step 4: Substitute the given values into the equations and calculate.
First, we need to know the total number of children in his town. From the problem, it is stated as 612 children. So, we can calculate the number of boys and girls from this information:
Total number of children = Total number of boys + Total number of girls
Given that Total number of children = 612, we can deduce:
Total number of boys + Total number of girls = 612

Now, let's calculate the answers to each step:

Step 1: Number of girls allowed = (1/2) × Total number of girls
Step 1: Number of boys allowed = (3/4) × Total number of boys
Step 3: Total candy pieces needed = (Number of girls allowed × 12) + (Number of boys allowed × 8)

By solving the equations, we can determine the final answer to how many candy pieces the gentleman had to buy.