Part 1 Create a script file in matlab to compute the cost of a pizza based on these parameters Ask the customer for the pizza size (8,10,14 inch) using input statement Ask the number of toppings using input statement. Just the number, not types. Compute the area of the pizza Compute the cost of the pizza - do not use “if” statements It costs 5 cents per square inch of pizza Add 5 cents per square inch for each topping Example; a plain pizza with 0 toppings costs $0.05* Area; A pizza with 2 toppings is that price + 0.05*Area*2 (I didn’t say it was a good pricing model!) Using an fprintf statement report to the customer “You ordered a ## inch pizza with ## toppings” “Your order will be $ ###.##” Using a display statement report “Thank you for your order” Part 2 Add complexity by adding a spaghetti bowl for $6 and a ravioli bowl for $8. Ask the customer for how many orders of each of the dishes Compute the total cost Report to the customer with a longer message “You ordered a ## inch pizza with ## toppings, ## orders of spaghetti and ## orders of ravioli. “Your order will be $ ###.##”

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

*I need help with part 2*

Part 1

Create a script file in matlab to compute the cost of a pizza based on these parameters

  • Ask the customer for the pizza size (8,10,14 inch) using input statement
  • Ask the number of toppings using input statement. Just the number, not types.
  • Compute the area of the pizza
  • Compute the cost of the pizza - do not use “if” statements
    • It costs 5 cents per square inch of pizza
    • Add 5 cents per square inch for each topping
      • Example; a plain pizza with 0 toppings costs $0.05* Area;
      • A pizza with 2 toppings is that price + 0.05*Area*2
      • (I didn’t say it was a good pricing model!)
    • Using an fprintf statement report to the customer
      • “You ordered a ## inch pizza with ## toppings”
      • “Your order will be $ ###.##”
    • Using a display statement report
      • “Thank you for your order”

Part 2

Add complexity by adding a spaghetti bowl for $6 and a ravioli bowl for $8.

  • Ask the customer for how many orders of each of the dishes
  • Compute the total cost
  • Report to the customer with a longer message
    • “You ordered a ## inch pizza with ## toppings, ## orders of spaghetti and ## orders of ravioli.
    • “Your order will be $ ###.##”
Expert Solution
Step 1

Solution with detail explanation using matlab comments:-

% prompt input
pizza_size = input('Enter pizza size (8,10,14 inch)');
toppings = input('number of toppings');
% since pizza square, area is pi* r^2, where
% radius is pizza_size

 
area = pi * (pizza_size ^ 2);
cost = 5 * area;
cost = cost + 0.05*area*toppings;

 
%fprintf("You ordered a %d inch pizza with %d toppings", pizza_size, toppings);
%fprintf("Your order will be $ %f", cost);
%disp('Thank you for your order');

 
% part 2:-
% one bowl cost $6 for spaghetti bowl and a ravioli bowl for $8
fprintf("how many orders of each dishes")
s = input('Enter orders for spaghetii');
r = input('Enter orders for ravioli');

 
cost = (s*6) + (r*8); % total cost computed.
fprintf("You ordered a %d inch pizza with %d toppings, %d orders of spaghetti and %d orders of ravioli.", pizza_size, toppings);
fprintf("Your order will be $ %f", cost);

 
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY