You are writing code that is part of a purchasing system. For each of the follow
ID: 3816242 • 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 Part Type 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 BuyerNameExplanation / Answer
% a
function printMenu()
fprintf("What you wish to buy ")
fprintf("Flange ")
fprintf("Bracket ")
fprintf("Hinge ")
end
printMenu()
partType = input("", 's');
% b
NumParts = input(["How many " partType " you wish to buy: "]);
% c
Buyername = input("Please enter your name: ", 's');
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.