“Arizona Best Pizzaria” made combo pizza that contains exactly 45 ounces of topp
ID: 3123630 • Letter: #
Question
“Arizona Best Pizzaria” made combo pizza that contains exactly 45 ounces of toppings. The base has a fixed weight and is not considered in the calculation. The available toppings are listed below with their corresponding weight (in ounces). There can be multiple entries of each topping, as long as the total weight is equal to 45 ounces. [20 points]
Topping
Weight (ounces)
Pepperoni
Meatball
Basil
Olives
Chicken
5
10
7
3
8
For example, a pizza can contain 1 topping of pepperoni, 2 toppings of meatball, 2 toppings of basil, and 2 toppings of olives : 1*5 + 2*10 + 2*7 + 2*3 = 45 (ounces)
A pizza cannot contain 6 toppings of chicken : 6 * 8 = 48 > 45
A pizza cannot contain only 3 toppings of meatball : 3*10 = 30 < 45
2.1 Define a rule pizza(P, M, B, O, C) to find out how many of each topping can be contained on a pizza, where P, M, B, O, and C are the numbers of the pepperoni, meatball, basil, olives, and chicken toppings, respectively. [14]
2.2 Write a rule called q2 :- condition, to ask the following question (goal), so that the grader to type | ?- q2. To test the question. [2]
| ?- pizza(1, 2, 2, 2, 2). Put all answers of the question in a comment in the file.
2.2 Write a rule called q3 :- condition, to ask the following question (goal), so that the grader to type | ?- q3. To test the question. [2]
| ?- pizza(1, M, 1, O, C). Put all answers of the question in a comment in the file.
2.3 Write a rule called q3 :- condition, to ask the following question (goal), so that the grader to type | ?- q3. To test the question. [2]
| ?- pizza(P, M, B, O, 1). Put all answers of the question in a comment in the file
Topping
Weight (ounces)
Pepperoni
Meatball
Basil
Olives
Chicken
5
10
7
3
8
Explanation / Answer
given
pepperoni 5
meatball 10
basil 7
olives 3
chicken 8
answer 2.1
for pepperoni
total waight 45/5=9
means 9 pepperoni toppings
for meatball=10*5=50>45 <10*4=40
4 so there only 4 topings of meatball
for basil:
7*6= 42
7*7=49
49>45>42
so only 6 topings of basil
for olives
53/3=15 means 15 topings of olives
for chicken
45/8=5.67
means 5 toppings can be used of chicken.
now 2.2: (pizza(1, 2, 2, 2, 2). Put all answers of the question in a comment in the file.
get the value
1 pepperoni= 5
2 meatballs= 20
2 basil =14
2 olives=6
2 chicken=16
total=61>45
now total waight should not>45
so conditions
1)5+20+14+6=45(1p,2m,2b,2o)
2 )20+6+16 =42<45(2m,2o,2c)
3) 5+14+6+16=41<45 (1p,2b,2c,2o)
now 2.2.1
now condition is
1,M,1,O,C
5+M+7+O+C<45
12+M+O+C<45
(1) M+2O+2C<33
10+6+16<33 =(1,1,1,2,2)
(2) 3m<33=(1p,3m,1b)
(3) 2m+o+c=20+3+8=31<33(1,2,1,1,1)
now 2.3
condition
(P0,M,B,O,1)
P+M+B+O+8<=45
P+M+B+O<=37
10+10+14+3=37
2P,1M,2B,1O,1C
0P+2M+2B+1O+1C=20+14+3+8=45
(2M,2B,10,1C)
SAME AS OTHERS CAN BE USED
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.