Week 1 Activity – Pseudocode

Only available on StudyMode
  • Download(s) : 306
  • Published : July 22, 2012
Open Document
Text Preview
Week 1 Activity – Pseudocode

-------------------------------------------------
TCO #1– Given a simple business problem, design and desk-check a solution algorithm that is expressed in terms of pseudocode or program notes and input-process-output (IPO) analysis leading to a flow chart. -------------------------------------------------

Assignment:

This activity will assist you in the understanding of how output should appear after statements are executed (results) and how to write proper pseudocode.

1. Show the result of each pseudocode program.
2. Also rewrite the pseudocode statements using Assignment statements.

Rubric:
When completed compile the following documents together neatly in 1 & 2 order: 1) This instruction sheet first
2) Your answer sheet, second

Point distribution for this activity:
Pseudocode Activity|
Document:| Points possible:| Points received|
Problem #1| 6| |
Problem #2| 6| |
Problem #3| 8| |
Total Points| 20| |

Problem #1:

The variable X starts with the value 0.
The variable Y starts with the value 5.
Add 1 to X.
Add 1 to Y.
Add X and Y, and store the result in Y.
Display the value in Y on the screen.

Output #1:
-------------------------------------------------

-------------------------------------------------
Y=7
-------------------------------------------------

Pseudocode #1:
-------------------------------------------------
Declare X=0
-------------------------------------------------
Declare Y=5
-------------------------------------------------
X = X + 1
-------------------------------------------------
Y= Y + 1
-------------------------------------------------
Y = X + Y
-------------------------------------------------
Display “Y=” Y
-------------------------------------------------

-------------------------------------------------

Problem #2:

The variable J starts with the value 10.
The variable K starts with the value 2.
The variable L starts with the value 4.
Store the value of J times K in J.
Store the value of K times L in L.
Add J and L, and store the result in K.
Display the value in K on the screen.

Output #2:
-------------------------------------------------
K = 16
-------------------------------------------------

-------------------------------------------------

Pseudocode #2:
-------------------------------------------------
Declare J=10
-------------------------------------------------
Declare K=2
-------------------------------------------------
Declare L=4
-------------------------------------------------
J=J*K
-------------------------------------------------
L=K*L
-------------------------------------------------
K=J+L
-------------------------------------------------
Display “K=” K
-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

Problem #3:

The variable A starts with the value 1.
The variable B starts with the value 10.
The variable C starts with the value 100.
The variable X starts with the value 0.
Store the value of C times 3 in X.
Add the value of B times 6 to the value already in X.
Add the value of A times 5 to the value already in X.
Display the value in X on the screen.

Output #3:
-------------------------------------------------
X=365
-------------------------------------------------

Pseudocode #3:
-------------------------------------------------
Declare A=1
-------------------------------------------------
Declare B=10...
tracking img