Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using matlab solve: You are working for a company that builds wood decks for pri

ID: 3788472 • Letter: U

Question

Using matlab solve:

You are working for a company that builds wood decks for private homes. The cost of a deck per square foot is $15.00. Write a MATLAB function file that computes the cost of a rectangular deck and checks to see if the deck is within a customer's budget. The input and output parameters are: Function inputs: deck width, deck length, and customer budget Function output: deck cost The program must print messages in the Command Window stating whether a specified deck is within the budget or not. Assuming a particular customer has a budget of $7500, test your function by using deck sizes of 25' times 25' and 25' times 20'.

Explanation / Answer

%Below is the function in Matlab to calculate Deck cost price
%and print the required message according to the customer budget
%-----------------------------------------------------------------------------

function cost = deckCost(width, length, budget)
   perSquareCost = 15;
   totalAreaDeck = (width * length);
   cost = (totalAreaDeck * perSquareCost);
   if(cost <= budget)
       disp('The Specified Deck is within the budget of the customer');
   else
       disp('The Specified Deck is Not in the budget of the customer');
   end
end

%cost comes out to be $9375 and it will not be within the customer budget
deckCost(25, 25, 7500);

%cost comes out to be $7500 and it will be within the customer budget
deckCost(25, 20, 7500);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote