0% found this document useful (0 votes)
10 views8 pages

Unit 5 Activities

Uploaded by

joan.viyuela4576
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Unit 5 Activities

Uploaded by

joan.viyuela4576
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

.1.

2.

3.
START
Ask person how many sugars they like
PROGRAM numSugars

PROGRAM myCount

SET myCount to 0

WHILE myCount<numsugars

ADD 1 spoon of sugar to cup

THEN

ADD 1 to myCount

END WHILE

END
4.
a.
Start
|
V
get toaster
|
V
get bread
|
V
Insert bread into toaster (two slices)
|
V
Start toaster
|
V
WHILE toast=not toasted
|
V
Wait for toaster to finish
|
V
END WHILE.
|
V
Remove toast from toaster
|
V
Spread butter on one side of the toast (both slices)
|
V
End

START
GET bread x 2
GET toaster
INSERT bread into toaster (two slices)
START toaster
WAIT for toaster to finish
REMOVE toast from toaster
SPREAD butter on toast (both slices)
END

b.
Start
|
V
IF clothes on
|
V
THEN get nude
|
V

IF NOT
|
V
END IF
|
V
Turn on water
|
V
Adjust water temperature
|
V
Step into shower
|
V
Wet body
|
V
Apply soap and scrub body
|
V
Rinse off soap
|
V
IF hair=dirty
|
V
THEN apply shampoo and extend on hair
| |
V V
IF NOT --- rinse off shampoo
|
V
END IF
|
V
Turn off water
|
V
Dry body with towel
|
V
End
START
IF clothes on
THEN get nude
IF NOT
END IF
TURN ON water
ADJUST water temperature
STEP INTO shower
WET body
APPLY soap and scrub body
RINSE off soap
IF hair=dirty
THEN apply shampoo and extend on hair
rinse off shampoo
IF NOT
TURN OFF water
DRY body with towel
END

c.
Start
|
V
Prompt user to enter the length of the side of the square
|
V
Read side_length
|
V
Calculate area = side_length * side_length
|
V
Display area
|
V
End

START
PROMPT user to enter the length of the side of the square
READ side_length
CALCULATE area = side_length * side_length
DISPLAY area
END
d.
Start
|
V
write”enter the radius of the circle”
|
V
Read radius
|
V
Calculate circumference = 2 * π * radius
|
V
Display circumference
|
V
End

START
PROMPT user to enter the radius of the circle
READ radius
CALCULATE circumference = 2 * π * radius
DISPLAY circumference
END

5.

Start
|
V

Problem Definition:
- Clearly define the
problem.
- Understand what is
to be achieved.

|
V

Data Analysis:
- Describe input and
output specifications.
- Analyze expected
results.
- Identify available
input data.
- Determine tools and
formulas needed.

|
V
Algorithm Design:
- Design the algorithm.
- Choose the best
algorithm if multiple
are available.
- Describe algorithm in
pseudocode or
flowchart form.

|
V

Program Coding: |
- Write the source code.
- Compile to obtain
object code.

|
V

Testing and Debugging:


- Test the program with
various types of data.
- Debug and correct any
errors.
- Refine for optimization.

|
V

Documentation:
- Create user guide and
comments within code.
- Ensure clear
instructions for use
and future modifications.

|
V

Maintenance:
- Update program as
needed.
- Reflect updates in
documentation.

|
V
End

6.
High-Level Languages:
Python
Java
C#
JavaScript
Ruby

Low-Level Languages:
Assembly Language
C

7.A compiler is a program that translates the entire source code of a programming language into
machine code or an intermediate code before the program is executed.Also the compilation process
occurs once, and the resulting machine code is executed directly by the computer's.Besides,
compiled programs typically run faster than interpreted programs because the translation to machine
code is done ahead of time.To finish, compilation detects errors in the entire code before execution,
which means that syntax errors and some types of semantic errors are identified before the program
runs.some examples are C, C++, Rust, and Go.

In the other hand,an interpreter translates source code into machine code line-by-line and executes it
immediately.The interpretation occurs at runtime, which means each instruction is translated and
executed in sequence.Although, interpreted programs generally run slower than compiled programs
because the translation happens at runtime.In addition Interpreters can only detect errors in the part
of the code that has been executed. This means that an error might only become apparent during
runtime.Some of them are Python, Ruby, JavaScript, or PHP.

So, to sum up, if you’re learning or you want to know exactly what you’re doing in every step, use an
interpreter. Otherwise, if you’re looking for speed and efficiency, you should really stick an eye on
compilers.

8. 8. pseint Joan Viyuela Ruiz

You might also like