Apr 01, 2023

Instructions to students: All questions are compulsory.

Dictionaries are not permitted.

#### TASK: G170 Computational Mathematics Assignment

Question 1.

(a) Goldilocks is shopping for a new bed in the January sales. She is 1.60m tall and is rather particular about what bed would be just right for her.

Supposed that we have named two cells in the spreadsheet Bed length and Goldilocks height. Write down the command line expression using Excel built-in functions that would return the phrase “Too small.” if the bed is less than 1.60m. It should return “Too big.” if the bed is 1.80m or longer. In all other cases it should return the phrase “This bed is just right and it has ” and this should be followed by the amount of extra space, which in turn should be followed by “meters space”. So, for example, if their calculation gave 0.1 meters, then the function should all-together return“This bed is just right and it has 0.1 meters space” [8 marks]

(b)In Fairy tale Kingdom, there is soon to be an election of a new Prime Minister. The Animal Party is currently thinking about asking Mr Wolf to stand for them against Miss Muffet However, while they think he is right for the job they worry about the fact that he is typically seen as “big and bad”. They wonder if educating the public could lead voters to think that he is actually just “misunderstood” and so vote for him. So they plan to take a look at small sample groups of 10 at a time.

Assume that the data is entered in A1:C10. In the first column are the numbers 1-10 denoting the participants in the group. In the second column is the reaction of the participant based on their existing knowledge. There are only two types of response and they are “big and bad” or “misunderstood”. In the third column are the replies after being re-educated and again only “big and bad” or “misunderstood” are entered.

Write a user defined program called voters that takes in the entries of A1:C10 as input. The program, voters, should count how many people initially said “big and bad” and count how many later said “misunderstood”. If more than half of those who initially said “big and bad” change to “misunderstood” then it should return the phrase “The strategy can work.”. If not then it needs to return “Back to the drawing board.”. You should define variable types of the input and output of the function, as well as of any other variables you may use in your program.

Recent Post