Question

In: Mechanical Engineering

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


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

Solutions

Expert Solution

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


Related Solutions

QUESTION 3 Use the information below to answer questions 3 through 5. The Cashman mortgage company...
QUESTION 3 Use the information below to answer questions 3 through 5. The Cashman mortgage company originated a pool containing 25 five-year fixed interest rate mortgages with an average balance of $100,000 each. All mortgages in the pool carry a coupon of 10%. (For simplicity, assume that all mortgage payments are made annually at 10% interest.) Assuming a constant annual prepayment rate of 10% (for simplicity, assume that prepayments are based on the pool balance at the end of the...
2. Revenue from the sale of ergonomic hand tools was $350,000 in years 1 through 3...
2. Revenue from the sale of ergonomic hand tools was $350,000 in years 1 through 3 and $450,000 in years 4 through 9. Determine the equivalent annual revenue in years 1 through 9 at an interest rate of 12% per year (show the cash flow diagrams for full credit)
Question 2: What are the 3 essential components of hand hygiene? Discuss when you should use...
Question 2: What are the 3 essential components of hand hygiene? Discuss when you should use soap and water vs. hand sanitizer. Question 3: Discuss and define practices that maintain a sterile field. Question 4: Culture is an important factor to consider for nurses, especially when it comes to diet. Explain vegan options for patients who need to increase protein.
QUESTION: Use the information below to answer the following questions. YEAR 0 (now) 1 2 3...
QUESTION: Use the information below to answer the following questions. YEAR 0 (now) 1 2 3 4 5 6 PROJECT A - 25,950 5,009 -1,123 6,500 7,089 7,544 8,908 PROJECT B - 31,950 8,000 7,500 7,000 6,500 -2,123 5,500 (a) Compute the payback period for both projects. Using the payback method, which project will be accepted? (b) If the interest (discount) rate is 12.5 %, what is the net present value (NPV) for both projects? Which project will be accepted...
Question 1 Use the following information to answer questions A through F: Jackson Outdoor Gear is...
Question 1 Use the following information to answer questions A through F: Jackson Outdoor Gear is one of the leading retailers of specialty sports gear. They recently changed from a price of $82.00 for their best-selling brand of hiking boots, at which they sold 1,450 pairs per month to a new, higher price of $92.00. At this new price point, Jackson Outdoor Gear has sold 1,225 pairs of the hiking boots. Variable costs per pair of boots are estimated at...
Discuss each question in 1-2 paragraphs. Answer the questions in “answer and question format”, that is,...
Discuss each question in 1-2 paragraphs. Answer the questions in “answer and question format”, that is, when you are posting, include both the questions and your answers. What are some challenges associated with working conditions in a globalized economy that effect US workers?
Question 2 a) Questions 1 through 8 are typical internal control questionnaires used for purchases and...
Question 2 a) Questions 1 through 8 are typical internal control questionnaires used for purchases and payment cycle. 1. Do personnel who are independent of the receiving and shipping functions and the payables and disbursing functions perform the purchasing function? 2. Are all receiving reports pre-numbered and the numerical sequence checked by a person independent of cheque preparation? 3. Does the mailroom route all vendors&#39; invoices directly to accounting department? 4. Does a responsible employee review and approve the invoice...
QUESTION 7 Use the following information to answer the next two questions: (Question 1 of 2)...
QUESTION 7 Use the following information to answer the next two questions: (Question 1 of 2) Higgins Company purchased specialized equipment on July 1, 2019, that cost $300,000, has a residual value of $40,000, and a useful life of four years. The amount of depreciation expense for 2020, under the double declining balance method is: A. $112,500. B. None of the above C. $97,500. D. $75,000. E. $125,000. 2 points    QUESTION 7 B Use the following information to answer...
Question Workspace Check My Work (3 remaining) eBook Problem Walk-Through Bond X is noncallable and has...
Question Workspace Check My Work (3 remaining) eBook Problem Walk-Through Bond X is noncallable and has 20 years to maturity, a 7% annual coupon, and a $1,000 par value. Your required return on Bond X is 8%; if you buy it, you plan to hold it for 5 years. You (and the market) have expectations that in 5 years, the yield to maturity on a 15-year bond with similar risk will be 6.5%. How much should you be willing to...
Question 1 (of 11)Question 2 (of 11)Question 3 (of 11)Question 4 (of 11)Questions 5 - 6...
Question 1 (of 11)Question 2 (of 11)Question 3 (of 11)Question 4 (of 11)Questions 5 - 6 (of 11)Questions 7 - 9 (of 11)Questions 10 - 11 (of 11)  Save & ExitSubmit   Time remaining: 0:51:30   Problem 7-5A Determine depreciation under three methods (LO7-4) [The following information applies to the questions displayed below.] University Car Wash built a deluxe car wash across the street from campus. The new machines cost $270,000 including installation. The company estimates that the equipment will have a residual...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT