You are writing code that is part of a purchasing system. For each of the follow
ID: 3816138 • Letter: Y
Question
You are writing code that is part of a purchasing system. For each of the following items, write a MATLAB statement to accomplish the task in one script:
a) Generate a menu that asks users what they wish to buy and gives them a choice of three items: Flange, Bracket, or Hinge. The user's choice should be placed in a variable named PartType
b) Ask users how many parts they wish to buy based on what they select in Part-a. Store the response in a variable named NumParts
c) Ask the user to enter his or her name after they enter the information from Part-b. Store the response in a variable named BuyerNam
Explanation / Answer
choice = menu('Choose to buy',Flange,Bracket,Hinge);
PartType = input(''Enter your wish to buy');
if PartType == 'Flange'
NumParts = input('How many Flange Parts You want to buy');
elseif PartType == 'Bracket'
NumParts = input('How many Bracket Parts You want to buy');
else
NumParts = input('How many Hinge Parts You want to buy');
end
BuyerNam = input('Enter You Name to place order','s');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.