Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Algorithm Fragment

Posted on 2010-08-16
3
Medium Priority
?
411 Views
Last Modified: 2012-05-10
Hi - I have been given these algorithm fragments to examine and answer some questions:

put on hat ;
IF(weather is sunny)
put on sunglasses;
ENDIF
put on shoes;

What items of clothing will be put on a) when it is rainging and b) when it is sunny?

- I imagine that if it is rainging it would be the hat and shoes and if it is sunny it would be the hat, shoes and sunglasses.

Go to shop;
buy milk;
IF(today is Saturday)
buy weekly newspaper;
buy peanuts;
ENDIF
buy bread

- What items will be purchased on a) Thursday b) Saturday?

I think that Thursday would be milk and bread and Saturday would be mild, newspaper, peanuts and bread.

Please could somebody just have a quick look at this and tell me if I'm on the right tracks and if not, let me know where I'm going wrong so that I can understand this.

Thank you in advance
0
Comment
Question by:peploe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 500 total points
ID: 33446565
>> - I imagine that if it is rainging it would be the hat and shoes and if it is sunny it would be the hat, shoes and sunglasses.

Correct. The if test is only true if it's sunny, so the if block is only executed is it's sunny.


>> I think that Thursday would be milk and bread and Saturday would be mild, newspaper, peanuts and bread.

Correct too.
0
 

Author Comment

by:peploe
ID: 33446602
Thank you :)
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 33446635
No problem. Glad to be of assistance :)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question