% Callback function for "Make Pizza" button
function MakePizzaButtonPushed(app, event)
% Initialize order details
orderDetails = '';
totalCost = 0;
% Get selected crust
selectedCrust = app.CrustGroup.SelectedObject.Text;
orderDetails = [orderDetails, 'Crust: ', selectedCrust, newline];
% Get selected sauce
selectedSauce = app.SauceKnob.Value;
orderDetails = [orderDetails, 'Sauce: ', selectedSauce, newline];
% Calculate price based on selected crust and sauce
price = 10; % base price
if strcmp(selectedCrust
, 'Thin Crust') price = price + 2;
end
if strcmp(selectedSauce
, 'BBQ') price = price + 1;
end
% Get toppings and calculate total cost
toppings = [app.ToppingSwitch1.Value, app.ToppingSwitch2.Value, ...
app.ToppingSwitch3.Value, app.ToppingSwitch4.Value];
% Count selected toppings
numToppings = sum(toppings);
totalCost = price + (numToppings * 1); % assuming each topping adds $1
% Update order details and cost
orderDetails = [orderDetails, 'Toppings: ', num2str(numToppings), newline];
orderDetails = [orderDetails, 'Total Cost: $', num2str(totalCost), newline];
% Display order in the text area
app.OrderTextArea.Value = orderDetails;
app.CostNumericEditField.Value = totalCost;
% Simulate pizza making process
app.Lamp.Color = 'yellow'; % Indicate cooking
app.Gauge.Value = 0; % Reset gauge
for i = 1:10
pause
(0.5); % Simulate baking
time app.Gauge.Value = i; % Update baking progress
end
app.Lamp.Color = 'green'; % Indicate ready
app.Slider.Value = app.Slider.Value + 1; % Increment pizza count
end
JSBDYWxsYmFjayBmdW5jdGlvbiBmb3IgIk1ha2UgUGl6emEiIGJ1dHRvbgpmdW5jdGlvbiBNYWtlUGl6emFCdXR0b25QdXNoZWQoYXBwLCBldmVudCkKICAgICUgSW5pdGlhbGl6ZSBvcmRlciBkZXRhaWxzCiAgICBvcmRlckRldGFpbHMgPSAnJzsKICAgIHRvdGFsQ29zdCA9IDA7CiAgICAKICAgICUgR2V0IHNlbGVjdGVkIGNydXN0CiAgICBzZWxlY3RlZENydXN0ID0gYXBwLkNydXN0R3JvdXAuU2VsZWN0ZWRPYmplY3QuVGV4dDsKICAgIG9yZGVyRG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