Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

By the end of the assignment, you will be able to: Write an algorithm using the four algorithmic building blocks: sequence of steps, repetition, choice

By the end of the assignment, you will be able to:
Write an algorithm using the four algorithmic building blocks: sequence of steps, repetition, choice and sub-algorithms.
Preamble
Using simple English sentences (in the style of the example algorithms presented in class), write algorithms for each of the following problems. Be sure to describe your algorithms accurately and explicitly. Assume that the person who reads your instructions does not understand the problem.
Type your algorithms into a word processor with your name and student number at the top. Use good indentation and spacing for readability.
Finally, remember the basic computer design rules and do not write code in any programming language!
Problem Statement
The problems:
A. Many jam recipes measure the amount of fruit and white sugar required in cups, for example. Other recipes use kilograms of fruit and white sugar, for example. Give an algorithm that will determine which recipe uses more white sugar. (Note: Pay attention to what type of sugar your recipe uses!)
B. Suppose you have a calculator with no square root button, but you really need to calculate x2. What do you do? You guess! (Carefully, of course.)
For example, suppose you need to calculate 272. You would first guess that 1 is your answer. Definitely not close enough because 12 is not close to 27. A second better guess is 1+2712, which is 14. Still not close enough because 142 is not close to 27. A third better guess is 14+27142=7.9642dots, which is still not close enough, but is closer! Keep going until your guess is accurate enough.
If a particular guess, n, is not close enough to being an accurate square root of a number x, we can produce a new and better guess by calculating n+xn2. For your algorithm, "accurate enough" means accurate to three decimal places.
1
LANGARA COLLEGE
COMPUTER SCIENCE 1150
C. Write an algorithm to determine whether it is cheaper for your instructor to purchase a Translink monthly pass for the month of February or to use Stored Value instead. (Assume your instructor arrives immediately before his first class at Langara and returns to New Westminster immediately after his last class each day.) Think about how you would generalize your algorithm so it will work for other instructors and other schedules and situations, too. ANSWER ALL 3
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

Students also viewed these Databases questions

Question

Discuss the significance of evolutionary theory to psychology.

Answered: 1 week ago

Question

Distinguish between HRD and human resource management (HRM)

Answered: 1 week ago

Question

Define what the four-fifths rule is.

Answered: 1 week ago