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”

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

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”

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 $ ###.##”

Inputs can be in vector form. Have the customer input how many drinks in vector form (We only offer one type but three sizes; small, med, large)

  • Ask the customer for how many drinks in small, med, and large using a single input statement. Note that the variable needs to be input as a vector using square brackets [ S, M, L ]
  • Create an fprintf statement that reads back the order using index addressing
    • Remember that you can address the index using syntax like: Drinks(1)
    • “You ordered ## small, ## medium, and ## large drinks.”
  • Reflection question: Could you add more types of drinks using a matrix form?
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Public key encryption
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