BIOL 1001 Chapter : CH 3 Student Outline

8 views4 pages
15 Mar 2019
School
Course
Professor
Algorithms 9/4/2013 4:38:00 PM
Algorithm A sequence of steps that is:
Unambiguous
Executable
Terminating
E.g. using sequential statements:
Job: To sum the total perimeter of a rectangle:
Get Length //Input
Get Width //Input
Let Perimeter = 2 x (Length + Width) //process + storage
Print Perimeter //Output
Algorithms can be written in Decision Statements, where choices are
given. If/Then statements fall here.
In this example, a machine detects the color of a traffic light and tells the
driver to stop or go accordingly.
1. Get color
2. If color = green then
action = go
3. else if color = red then
action = stop
4. else //This applies if the light is anything but green or red
action = proceed with caution
5. take action
the “else” term only occurs in instances when you can only have one of
many options
E.g.:
If score >90 then
grade=A
If score >95 then
grade=Free Dinner
The above sequence doesn’t have “else” because you are allowed to have
these multiple actions. If you had else, then you would only have one of the
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Algorithm a sequence of steps that is: unambiguous, executable, terminating. Job: to sum the total perimeter of a rectangle: Let perimeter = 2 x (length + width) //process + storage. Algorithms can be written in decision statements, where choices are given. The above sequence doesn"t have else because you are allowed to have these multiple actions. If you had else, then you would only have one of the two, and the program would be mutually exclusive. (i. e. : the program would stop after dinner, because it"s completed it"s task) For example, the problem 1+2+3+[ ]+n: get n, let sum=0, let term=1, while term <=n do sum=sum+term term=term+1 end while //loop here, print sum. Object: class is a construct or blueprint that can describe an object. It shows attributes and behaviors that objects can use: another view is that the class is a group of objects with similar attributes. The fact that it can fly is its method.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents