Group 5 Computer Algorithm Lab 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

DAT13303

ALGORITMA KOMPUTER

SECTION: 5

LAB: 2

LECTURER NAME: DR. WAN IBTISAM BINTI HAJI WAN OMAR

STUDENT NAME
NAME MATRIK NUMBER
ALLY AKHTAR BIN ANWAR AA232367
MUHAMMAD IKHWAN ASHRAF BIN MOHD RAZIF AA230429
MUHAMMAD IZAM IZANI BIN MOHD NAZIHA AA231986

DATELINE: 29 OCTOBER 2023


INTRODUCTION
In this assignment, we are assigned to define algorithmic problem which is we need to solve
the given problem by using algorithm. In addition we need to identify the input, process, and
output of the problems.Input represents the data or information that is provided to a system or
process at the beginning.While, process refers to the actions, operations, or transformations
that the system performs on the input data. Beside, output represents the results or
information that the system generates after processing the input. at the end of the task,we
need to design expected screen. expected screen is a picture of how the screen
will be displayed.

Write the pseudocode (basic and detail) and draw the flowchart for each of the
following problem based on your Lab 1.
1. Calculate the new salary after a 15% increase.

Phrase 3:Algorithm Design


Pseudocode:
1. Basic

Start
Declare variables
Input salary
Calculate new salary
Display sum
End

2. Detail

Begin
Declare aos,ns
Display “Enter your salary”
Get aos
Calculate ns=(0.15*aos)+aos
Display “New Salary”
Stop
Flowchart:

CONCLUSION : In conclusion the old salary is 7500.The new salary aftrer 15%
increase is 8625.
2. Calculate the average mark of five students.

Pseudocode:

1. Basic

Start
Declare variables
Input mark student
Calculate 5 numbers and divide all by the number of marks
Print the average mark
End

2. Detail

Begin
Declare ms1,ms2,ms3,ms4,ms5
Display “Enter mark student 1”
Display “Enter mark student 2”
Display “Enter mark student 3”
Display “Enter mark student 4”
Display “Enter mark student 5”
Get ms1,ms2,ms3,ms4,ms5
Calculate av = (ms1 + ms2 + ms3 + ms4 + ms5) / 5
Display “average mark”
Stop
Flowchart:

CONCLUSION :
In order to get the average mark, the total mark of five students were divided by 5 and
get 84 as the answer.
3. Calculate the new price after a 10% discount.

Pseudocode:
1. Basic
Start
Declare variables
Input original price
Calculate new price after discount
Display new price
End

2. Detail

Start
Declare originalprice As float
Display “Enter original price”
Get original price
Calculate new price =(0.1 * originalprice) – originalprice
Print “new price: ”, np
End
Flowchart:

CONCLUSION :
To sum up, to get the new price after 10% discount is, the original price need to multipy
with 0.1 and minus by original price and the answer is 72546.80.
4. Calculate the volume of a pyramid.

Pseudocode:

1. Basic

Start
Declare variables
Input height of pyramid,length of pyramid,width of pyramid
Calculate volume of pyramid = (p_h * p_l * p_w / 3)
Display Volume of pyramid
End

2. Detail

Begin
Declare p_h, p_l, p_w
Display “Enter height of pyramid”
Display “Enter length of pyramid”
Display “Enter width of pyramid”
Get p_h, p_l, p_w
Calculate vop = (p_h * p_l * p_w / 3)
Display “Volume of pyramid”
Flowchart:

Conclusion:
In order to get volume of pyramid, the pyramid’s height, length and width need to be multiply
and divided by 3. The answer should be 58.3333.

You might also like