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

For questions 1, 2, and 3, walk through each question by hand, then use the “dis

ID: 2075051 • Letter: F

Question


For questions 1, 2, and 3, walk through each question by hand, then use the “disp” command in your MATLAB script to display your answer to the screen.
1. What is the final value of x? x = 10; if round(x/5) == x/5 x = 2 * x + 4; elseif x == 10 x = 4 * x; else x = 0; end
2. What is the final value of x? x = 10; if round(x/3) == x/3 x = 2 * x + 4; elseif x == 10 x = 4 * x; else x = 0; end
3. What is the final value of x? x = 9; if round(x/4) == x/4 x = 2 * x + 4; elseif x == 4 x = 4 * x; else x = 0; end
4. Write a MATLAB script that calculates the total cost for Giant Slinkys: • Ask the user to input the quantity of Giant Slinkys they wish to have shipped. • Make sure the user's input is a positive integer. • 10 or fewer Giant Slinkys cost $21.99 each. • 11 to 50 Giant Slinkys are $19.99 each • 51 to 100 Giant Slinkys are $17.99 each • More than 100 Giant Slinkys cost $15 each. • Sales tax is 9.5% • Shipping is $10 for each group of 10 Giant Slinkys. For example: Shipping for 1 Giant Slinky is $10; Shipping for 8 is also $0; Shipping for 10: $10. Shipping for 11 Giant Slinkys is $20; Shipping for 15, also $20; Shipping for 20: $20. • Shipping is free for orders of 50 or more Giant Slinkys

Explanation / Answer

1.

clear all;close all;clc;commandwindow;

x=10;

if round(x/5)==x/5

x=(2*x)+4;

else

if x==10

x=4*x;

else

x=0;

end

end

disp(x);

2.

x=10;

if round(x/3)==x/3

x=(2*x)+4;

else

if x==10

x=4*x;

else

x=0;

end

end

disp(x);

3.

x=10;

if round(x/4)==x/4

x=(2*x)+4;

else

if x==10

x=4*x;

else

x=0;

end

end

disp(x);

4.

quantity=input('enter the number of giant slinkys you wish to ship');

if quantity<0

display('Please enter a positive value');

else

flag=0;

if quantity<=10

cost=quantity*21.99;

end

if quantity>=11 && quantity<=50

cost=quantity*19.99;

end

if quantity>=51 && quantity<=100

cost=quantity*17.99;

end

if quantity>100

cost=quantity*15;

end

if quantity>=50

shipping_cost=0;

else

quantity=ceil(quantity/10);

shipping_cost=quantity*10;

end

cost=cost+((cost*9.5)/100)+shipping_cost;   

display('total cost is:')

display(cost);

end

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