Solved

Algorithm Fragment

Posted on 2010-08-16
3
367 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 125 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Storing Passwords Versus Hashes in Challenge-Response Authentication 20 579
small programing exercises 5 105
RNGCryptoServiceProvider Random Numbers 2 117
Two list de-cypher 6 103
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…
The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20. The divisors of 12 are 1, 2, 3, 4, 6, 12 The divisors of 20 are 1, 2, 4, 5, 10 20 The highest number among the c…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
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…

738 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