Question

WA08A: "Sally’s Apples” Our friend Sally from ICE08 has received our input on buying 8 apples...

WA08A: "Sally’s Apples” Our friend Sally from ICE08 has received our input on buying 8 apples to buy each day. In ICE08C, we calculated the amount of apples that Sally finished with for that month to meet her goal of 110 to bring to her meeting. Now, Sally became too busy with other responsibilities and does not go out to the meetings every month. Still yet, Sally buys eight fresh apples each day just in case her horse wants more than four. Problem: Conditionals Sally finds that her pantry is completely full of apples and that she needs to clear her pantry out. She decided that once she has 140 apples stored up, she decides to donate a bag of 25 apples to the local ‘homeless shelter’. You problem is to modify the program to account for her donation of 25 apples every few days. As some trivia, that’s 2 “pecks” of apples in the English system of measures. To start, download Dr. Lyver’s answer to ICE08C for Sally. The code “ICE08_Sally_answer.m” is below and can be found on the Class website. PLEASE do not start with your answer to ICE08C. % Dr J.Lyver % CDS-130 ICE08C_Sally.m Sally's Apples % 1/19/2019 clear;clc total_apples(1) = 0; %Initial Starting Apples days = 30; %Assuming the month has 30 days in it apples_added = 8 %Apples that are added each day apples_eaten = 4; %Apples that are eaten each day for day = 1:30 total_apples(day+1) = total_apples(day) + apples_added; %Amount of apples added total_apples(day+1) = total_apples(day+1) - apples_eaten; %Amount of apples eaten end total_apples(days+1) The question is: How many apples will Sally have to take to the June meeting assuming that she still buys 8 apples per day, her horse eats 4 per day and she makes the donation described above. She has zero apples on May 1st and her next meeting is on the 53rd day. Hint: You will need to add an “IF” statement AFTER Sally buys her morning apples and feeds her horse. Also remember that there are now 53 days in the time period (aka: month).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please, please upvote and ask your doubts in the comments, thanks.



Code Screenshot:




Code:

clear; clc
total_apples(1) = 0;
days = 52;
apples_added = 8;
apples_eaten = 4;
donation = 25;
threshold = 140;

for day = 1:52
total_apples(day+1) = total_apples(day) + apples_added;
total_apples(day+1) = total_apples(day+1) - apples_eaten;
if total_apples(day+1) >= threshold   
%if number of apples more than or equal to 140
total_apples(day+1) = total_apples(day+1) - donation;
% donate 25 apples
end
end
total_apples(day+1)

Output:




Add a comment
Know the answer?
Add Answer to:
WA08A: "Sally’s Apples” Our friend Sally from ICE08 has received our input on buying 8 apples...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • My question is about the case study “ Comparing Apples and Oranges: which group yuelds the...

    My question is about the case study “ Comparing Apples and Oranges: which group yuelds the best profit?” 1) Using the Excel apreadsheet attached to complete the rooms sold and revenue projections based on the above case study. Case Study: "Comparing Apples and Oranges: Which Group Yields the Best Profit?" ​The Diamond Peak Hotel, one of 45 hotels in the Host Marriott management company, was bustling with business this Thursday afternoon as the hour of the daily revenue meeting drew...

  • A Routine Endoscopic Procedure Our mother usually had an endoscopic procedure every 2 years. We thought...

    A Routine Endoscopic Procedure Our mother usually had an endoscopic procedure every 2 years. We thought that she had too many visits with her gastroenterologist. She saw the gastroenterologist about every 30 or 60 days. When we asked the physician why our mother had to come in on a continuous basis, his response was “acid reflux.” She was taking a proton pump inhibitor for her acid reflux. Our mother had an endoscopy of her upper gastrointestinal tract in September 2006....

  • 1-12 please practice PATIENT CASE Mother's Chief Complaints "Our daughter has been vomiting and has had...

    1-12 please practice PATIENT CASE Mother's Chief Complaints "Our daughter has been vomiting and has had diarrhea for three days. She also has had a fever, but I've been giving her acetaminophen every six hours. The clear liquids and Pedialyte that she has been drinking don't seem to be helping much and she looks so sickly." HPI J.L. is a 4%-month-old Asian American female infant who was taken to the emergency room of a local hospital because her parents were...

  • case study Daniel just graduated from Michigan University and landed a job as a copywriter at...

    case study Daniel just graduated from Michigan University and landed a job as a copywriter at Young, Olsen, Lindle, and Olson (YOLO) Advertising assigned to one of the subsidiary accounts of Delicious Uber Bacon Ingredients Extraordinaire Corporation. This conglomerate was primarily a food processing manufacturer beginning one hundred years ago with pork in the Midwest. Overall corporate sales of beef, chicken, pork, and seafood were more than $ million each year. YOLO considered many advertising options and opted for a...

  • 3. Compare the m o st from home with finansnede with the helm package pretesnacks. Which...

    3. Compare the m o st from home with finansnede with the helm package pretesnacks. Which is and why Note that wing the media half cup s is roughly equivalent to wings of pets pets or gram Nutrition Facts Wheel Rour Water Com Byne Pay Handel Cartons Sad 4. Evaluate your own dict. Write down every item you eat in a day and find the values of the nutrients contained in the foods. A medical dictionary is a good source...

  • Sarah has always loved the kind of music described as “country and western” music. After leaving...

    Sarah has always loved the kind of music described as “country and western” music. After leaving school she decided to start a business importing the kinds of clothing and accessories that lovers of country and western music liked to wear. Eventually the demand for this style of clothing became so big that Sarah leased a shop in a suburban shopping centre where she sold her clothing under the name “Sarah”. Sales increased even more when Sarah also played the latest...

  • 1. Focusing on only the inpatient care cost (i.e., ignoring operating room costs), what is the...

    1. Focusing on only the inpatient care cost (i.e., ignoring operating room costs), what is the cost of a TAH (non-oncology) under each of the cost accounting systems? A tuboplasty? A TAH (oncology)? What accounts for the differences? Croswell University Hospital This report doesn't describe where our costs are generated. We're applying one standard to all patients, regardless of their level of care. What incentive is there to identify and account for the costs of each type of procedure? Unless...

  • The flight attendant had to ask her twice, “Anything to drink, ma’am?” “Oh, sorry. Water, no...

    The flight attendant had to ask her twice, “Anything to drink, ma’am?” “Oh, sorry. Water, no ice, please,” said Noelle Freeman, the CFO of Franklin Climate Systems. Watching the clouds out her window at 30,000 feet, she’d been deep in thought. She was on her way home from two days in Arkansas visiting her company’s largest facility. Franklin was in the business of designing, engineering, and manufacturing climate control systems for cars and SUVs. This is a division of FB...

  • What is the amount of cash received from the sale of special materials if Horizon Insurance elects to outsource publishing to G-Art?

    What is the amount of cash received from the sale of special materials if Horizon Insurance elects to outsource publishing to G-Art? Use the following case to help answer this question: Horizon Insurance (HI) was a full-service regional insurance agency that has done all the printing and publishing of its own promotional brochures, newsletters, informational pamphlets, and required regulatory reports. Linda Wolfe, the business manager of the agency, had for some time thought that the firm might save money and...

  • Sunshine Enterprises Case Study “I think the waiter wrote in an extra $25 tip on my Sunshine Café...

    Sunshine Enterprises Case Study “I think the waiter wrote in an extra $25 tip on my Sunshine Café bill after I received and signed my credit card receipt,” Mr. Mark Otter said to the restaurant manager, Brad Gladiolus. “Mr. Otter, mail me a copy of the restaurant receipt and I’ll investigate,” responded Mr. Gladiolus. “I don’t have the receipt—I lost it—but I have my monthly credit card statement,” replied Mr. Otter. Mr. Gladiolus hesitated, then said, “Mr. Otter, I don’t...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT