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

Using Matlab Write a program that will give a user a list of hardware items to b

ID: 673617 • Letter: U

Question

Using Matlab

Write a program that will give a user a list of hardware items to be purchased including:

Nails           @ $1.50/lb

Screws                @ $2.35/lb

Hammer     @ $20.29

Screw gun      @    $87.42

Sheet metal     @ 1.50/ft2

Have the user select their purchases then add up the bill and output the items bought and the total. Also charge the customer 6% sales tax. Use the switch statement and a while loop to keep asking your customer if they are done with their order.

Include flow-chart, pseudo code.

Explanation / Answer

----%Program to create bill of purchase for hardware items
bill=0;
salesTax=0;
choice='y';
while strcmpi(choice, 'y')==0
disp('List of hardware items available');
disp('------------------------------------------');
disp('Name Price in $/lb');
disp('------------------------------------------');
disp('1.Nails       1.50 ');
disp('2.Screws       2.35 ');
disp('3.Hammer       20.29 ');
disp('4.Screw gun   87.42 ');
disp('5.Sheet metal   1.50/ft2 ');
disp('------------------------------------------');
item= input('Enter the item number you want:');
switch item
case 1
bill=bill+1.50;
case 2
bill=bill+2.35;
case 3
bill=bill+20.29;
case 4
bill=bill+87.42;
case 5
size= input('enter square metal size:');
bill=bill+(size*1.50);
otherwise
disp('wrong option');
end
choice= input('Do you want to purchase more y/n:');
salesTax=bill*6/100;
disp('--------------------');
disp(' BILL');
disp('--------------------');
fprintf('Total purchase:$%f ',bill);
fprintf('Sales Tax:$%f ',salesTax);
bill=bill+salesTax;
fprintf('Total Bill Amount:$%f ',bill);
end

%------------------------------------------------------------------------------

Flowchart:

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