Problem 2: Wholesale price is the price charged for a product as sold in bulk to large trade or distributor groups as opposed to what is charged to consumers. Use the elseif clause to determine unit price and determine the total price for those items. Ask MATLAB to generate a random integer C between 0 to 20000, to check your code. Quantity > 8000 5000

Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
icon
Related questions
Question

please write a matlab code

Problem 2: Wholesale price is the price charged for a product as sold in bulk to
large trade or distributor groups as opposed to what is charged to consumers. Use
the elseif clause to determine unit price and determine the total price for those
items. Ask MATLAB to generate a random integer C between 0 to 20000, to check
your code.
Quantity
> 8000
5000 < quantity < 8000
2000<quantity<5000
<2000
Unit Price
$22 * 0.55 (45% off)
$22*0.75 (25% off)
$22
Cannot be purchased as wholesale
Transcribed Image Text:Problem 2: Wholesale price is the price charged for a product as sold in bulk to large trade or distributor groups as opposed to what is charged to consumers. Use the elseif clause to determine unit price and determine the total price for those items. Ask MATLAB to generate a random integer C between 0 to 20000, to check your code. Quantity > 8000 5000 < quantity < 8000 2000<quantity<5000 <2000 Unit Price $22 * 0.55 (45% off) $22*0.75 (25% off) $22 Cannot be purchased as wholesale
Expert Solution
Step 1: Explanation of the code


 format short %calling function %asking matlab for random integer between 0-20000 quant = randi(20000);

x = price(quant); fprintf("unit price = %f",x) price(20) %defining function price which calculate unitprice function unitprice = price(quant)

if quant>8000  , unitprice = 22*0.55;

elseif 5000<quant && quant<8000 unitprice = 22*0.75;

elseif 2000<quant && quant<5000 unitprice = 22;

else unitprice = "Can not be purchased as wholesale";

end end 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Properties of Pure Substances
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, mechanical-engineering and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Elements Of Electromagnetics
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Control Systems Engineering
Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY
Mechanics of Materials (MindTap Course List)
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning
Engineering Mechanics: Statics
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY