You are on page 1of 29

CSC121 : INTRODUCTION TO ALGORITHM DESING

Group Project
Report
Fintech, simplified
Table of

Introduction

Contents
Problem 1

Problem 2

Problem 3

Conclusion
Introduction
This course is titled Introduction to Algorithm Design and Development. By this, it is

evident that this course concentrated more on the problem-solving procedures that

include algorithm creation and development than it did on the notion of computer

systems in general. Additionally, it will expose the students to various programming

control structures, such as sequential, selection, and repetition control structures,

and teach them how to solve problems using flowcharts and pseudocode. The

concept of designing algorithms for modules or functions was also presented to the

students. Students were to use the Program Development Life Cycle to solve three

separate difficulties for this project (PDLC). The precise steps for solving problems

will be followed by the students. Students will then go to the second stage,

algorithm design, where they will create an algorithm to address the issue. The

logical solution algorithm will be integrated by the students at this stage in the form

of pseudocode or a flowchart. In spite of this, students must create a flowchart and

pseudocode for this project in order to complete it. Students will then proceed to

the following stage, algorithm implementation, and finish with the last step,

programme testing and debugging. Students will next discuss the control structure

and function that have been applied in problem solving, followed by any limitations

or suggestions for development for the future.


v
Problem 1:
INPUT PROCESS OUTPUT

1. Read number
2. Convert string number to integer num
3. sum+=num
string number 4. If number = ‘=’ sum
5. repeat false
Else if number != ‘=’ and number != num
Display wrong input characters
Pseudocode Flowchart
1. Start
2. Declare sum and num = 0
3. Declare bool repeat is true
4. While repeat is true
5. Read string number
6. Convert string number to integer num
7. PROCESS sum+=num
8. IF number is equal to ‘=’
9. repeat is false
10. ELSE IF number is != ‘=’ and number is != num
11. DISPLAY Wrong input character
12. EndIf
13. DISPLAY sum
14. End
Discussion
-This flowchart and pseudocode were created in this programme using a Multi-Way Selection (if-

else-if).
-Another method we utilized to develop a solution for this challenge was to code; by doing this, we

were able to more clearly understand how the flowchart and pseudocode function.
-How does this program work?
-Firstly, users have to insert any number.
-They can input as many as they want
-However, if the users insert a character or other than ‘=’ sign, the program will display “Wrong

Input Characters”
-The program will stop if the user insert ‘=’ sign.
-All of the number that was insert by the users will be calculate into sum
-What is the source of the sum?
-In order to calculate all of the numbers that the user has entered, we built a new variable.
-We construct it with a value of 0, which means that as long as the user keeps adding numbers, the

total will rise in step with those additions.


-In order to present the total of all the numbers, sum was mostly added.
-Way to enhance?
-We'll take into account making this software able to execute a command provided by the user.
-For instance, this application may perform more sophisticated operations than simply the simple

addition of all the numbers; the user can select the operation they wish to perform and make their

own adjustments.
-This application is also capable of displaying the mathematical computations.
Problem 2:
INPUT PROCESS

Declare integer option and donateTimes


Declare string donorID, groupCode, PhoneNum, and donationDate

If option is 1
call
getInput(donorID, groupCode, donationDate, donateTimes, phoneNum)
Read option
Read ID call information(donorID, groupCode, donationDate, donateTimes, phoneNum)
Read code
Read count Else If option is 2
Read date call inventory()
Read contact
If count is 1
return date
else
find the last “|” character in date and store in pos
extract everything before pos and store the new string into lastDate
return lastDate
OUTPUT

Display “Donor ID: “ and ID


Display “Group code: “ and code
Display “Last donation date: “ and call lastDntnDate(date, count)
Display “Contact number: “ and contact

Display “Code: BL_ABP”, Blood Group: AB+”, “Current Stock (bags): 542”, “Cumulative Collection (bags): 4300”

Display “Code: BL_ABN”, Blood Group: AB-”, “Current Stock (bags): 361”, “Cumulative Collection (bags): 3165”

Display “Code: BL_APO”, Blood Group: A+”, “Current Stock (bags): 193”, “Cumulative Collection (bags): 1100”

Display “Code: BL_ANE”, Blood Group: A-”, “Current Stock (bags): 200”, “Cumulative Collection (bags): 1100”

Display “Code: BL_BPO”, Blood Group: B+”, “Current Stock (bags): 106”, “Cumulative Collection (bags): 2560”

Display “Code: BL_BNE”, Blood Group: B-”, “Current Stock (bags): 487”, “Cumulative Collection (bags): 2100”

Display “Code: BL_OPO”, Blood Group: O+”, “Current Stock (bags): 1290”, “Cumulative Collection (bags): 15200”

Display “Code: BL_ONE”, Blood Group: O-”, “Current Stock (bags): 2126”, “Cumulative Collection (bags): 10932”
PSEUDOCODE
Pseudocode for the function "information":
1.Display "Donor ID: " followed by the passed in donor ID
2.Display "Group code: " followed by the passed in blood

group code
3.Call the "lastDntnDate" function, passing in the passed

in donation date and number of times donated, and

assign the returned value to a variable "lastDonation"


4.Display "last donation date: " followed by the value of

the "lastDonation" variable


5.Display "Phone number: " followed by the passed in

phone number
PSEUDOCODE
Pseudocode for the function "inventory":
1.Display "Code: BL_ABP" "Blood Group: AB+" "Current Stock (bags): 542" "Cumulative Collection (bags):

4300"
2.Display "Code: BL_ABN" "Blood Group: AB-" "Current Stock (bags): 361" "Cumulative Collection (bags):

3165"
3.Display "Code: BL_APO" "Blood Group: A+" "Current Stock (bags): 193" "Cumulative Collection (bags):

1100"
4.Display "Code: BL_ANE" "Blood Group: A-" "Current Stock (bags): 200" "Cumulative Collection (bags):

1100"
5.Display "Code: BL_BPO" "Blood Group: B+" "Current Stock (bags): 106" "Cumulative Collection (bags):

2560"
6.Display "Code: BL_BNE" "Blood Group: B-" "Current Stock (bags): 487" "Cumulative Collection (bags):

2100"
7.Display "Code: BL_OPO" "Blood Group: O+" "Current Stock (bags): 1290" "Cumulative Collection

(bags): 15200"
8.Display "Code: BL_ONE" "Blood Group: O-" "Current Stock (bags): 2126" "Cumulative Collection (bags):

10932"
PSEUDOCODE
Pseudocode for the main function:
1.Display "Hospital Blood Bank Library"
2.Display menu options to the user: "1- Search Donor" and "2- Blood Stock"
3. Get user input for the selected option
4. If the user selects option 1:
a. Ask user for their ID, blood group code, number of times they have donated, donation date, and

phone number
b. Pass these values as parameters to the "information" function
5. If the user selects option 2:
a. Call the "inventory" function
6. If the user enters an invalid option, display "Invalid input."
7.Check if the number of times donated is equal to 1 a. If true, return the passed in donation date
8.Find the position of the "|" character in the passed in donation date
9.Extract the substring of the donation date after the "|" character and assign it to a variable "lastDate"
10.Return the "lastDate" variable
11.End program
FLOWCHART
DISCUSSION
-This flowchart and pseudocode were created in this

programme using a Multi-Way Selection (if-else-if) and

void function.
-Coding allowed us to design a solution for this difficulty

in a different way, and it also helped us better grasp how

the pseudocode and flowchart work.


-How does this program work?
-Firstly, users are required to choose which option he/she wants.
-If they choose option 1, the program will call a function named getInput.
-Then, they need to insert their donorID, groupCode, donationDate, donateTimes,

phoneNum.
-The program will proceed to call a function named information
-Else if they choose option 2, the program will straight forward calling function

named inventory
-If count is 1 then the function will return a date.
-Else, the function will return the latest date of donation
-Way of Enhance?
-This program can be enhanced by using an array in order to store all of the

information given.
It is easier to
Problem 3:
INPUT PROCESS

if (bunny1 > bunny2 && bunny1 > bunny3 && bunny2 > bunny3)

else if (bunny1 > bunny2 && bunny1 > bunny3 && bunny3 > bunny2)

else if (bunny2 > bunny1 && bunny2 > bunny3 && bunny1 > bunny 3)

int bunny1, bunny2. bunny3

else if (bunny2 > bunny1 && bunny2 > bunny3 && bunny3 > bunny1)

else if (bunny3 > bunny1 && bunny3 > bunny2 && bunny1 > bunny2)

else
OUTPUT

Display
“Bunny 1 : I am the tallest”
“Bunny 2 : I am the shorter than Bunny 1 and I am taller than Bunny 3"
“Bunny 3 : I am the shortest”

Display
“Bunny 1 : I am the tallest”
“Bunny 2 :I am the shortest"
“Bunny 3 : I am the shorter than Bunny 1 and I am the taller than Bunny 3”

Display
“Bunny 1 : I am the shorter than Bunny 2 and I am the taller than Bunny 3”
“Bunny 2 : I am the tallest"
“Bunny 3 : I am the shortest”
OUTPUT

Display
“Bunny 1 : I am the shortest”
“Bunny 2 : I am the tallest"
“Bunny 3 : I am the shorter than Bunny 2 and I am the taller than Bunny 1”

Display
“Bunny 1 :I am the shorter than Bunny 3 and I am the taller than Bunny 2”
“Bunny 2 : I am the shortest"
“Bunny 3 :I am the tallest”

Display
“Bunny 1 :I am the shortest”
“Bunny 2 : I am the shorter than Bunny 3 and I am the taller than Bunny 1"
“Bunny 3 :I am the tallest”
PSEUDOCODE
1. Start
2. input height of bunny1, bunny2, bunny3
3. if (bunny1 > bunny2 && bunny1 > bunny3 && bunny2 > bunny3)
4. display "Bunny 1 : I am the tallest"
5. display "Bunny 2 : I am the shorter than Bunny 1 and I am taller than Bunny 3"
6. display "Bunny 3 : I am the shortest"
7. else if (bunny1 > bunny2 && bunny1 > bunny3 && bunny3 > bunny2)
8. display "Bunny 1 : I am the tallest"
9. display "Bunny 2 : I am the shortest"
10. display "Bunny 3 : I am the shorter than Bunny 1 and I am the taller than Bunny 3"
11. else if (bunny2 > bunny1 && bunny2 > bunny3 && bunny1 > bunny 3)
12. display "Bunny 1 : I am the shorter than Bunny 2 and I am taller than Bunny 3"
13. display "Bunny 2 : I am the tallest"
14. display "Bunny 3 : I am the shortest"
PSEUDOCODE
1. else if (bunny2 > bunny1 && bunny2 > bunny3 && bunny3 > bunny1)
2. display "Bunny 1 : I am the shortest"
3. display "Bunny 2 : I am the tallest"
4. display "Bunny 3 : I am the shorter than Bunny 2 and I am the taller than Bunny 1"
5. else if (bunny3 > bunny1 && bunny3 > bunny2 && bunny1 > bunny2)
6. display "Bunny 1 : I am the shorter than Bunny 3 and I am taller than Bunny 2"
7. display "Bunny 2 : I am the shortest"
8. display "Bunny 3 : I am the tallest "
9. else
10. display "Bunny 1 : I am the shortest"
11. display "Bunny 2 : I am the shorter than Bunny 3 and I am taller than Bunny 1"
12. display "Bunny 3 : I am the tallest"
13. End
FLOWCHART
DISCUSSION
-This flowchart and pseudocode were created in this

programme using a Multi-Way Selection (if-else-if).


-Another method we utilized to develop a solution for this

challenge was to code; by doing this, we were able to more

clearly understand how the flowchart and pseudocode

function.
-How does this program work?
-Firstly, users need to input the height of bunny1, bunny2, and bunny3.
-After that, the program will read the height of the three bunnies and look into the

condition.
-If the first condition is true, then it will display attached output.
-If the first condition is false, then the program will proceed to the second condition.
-This phase will repeat until all of the conditions are false and the program will display the

last output.
-Way to enhance?
-It is way easier to store the height of the three bunnies by using an array.
-Combining it with user-defined functions, there will be no need for so many conditions in

the program.
-The program will look way cleaner and simple instead of having too many conditions.
CONCLUSION
-Challenge?
-Problem 1:
-Converting a string data type's declaration to an int data type
-Avoiding an endless cycle
-Establishing loop structures
-Problem 2:
-Determining the problem's prerequisite
-Obtaining the data from the function and displaying it on the primary function
-Displaying a lot of output information
-Constructing the method from the stringent and necessary question
-Applying structure to the problem-solving process
-Problem 3:
- Calculating the height based on user input
- Relating each bunny's height in order to show a reliable result
.
-Benefits?
-First and foremost, the algorithm is not dependent on any programming

language so it is easy to understand for everyone even without a programming

knowledge. In addition the algorithms can be classified as an easy programming

language and it always helps us in our problem solving.


-Second, an algorithm is a defined set of step-by-step procedures that provides
the correct answer to a particular problem. By following the instructions

correctly, we are guaranteed to arrive at the right answer in problem solving. An

algorithm is often expressed in the form of a graph, where a square represents

each step. So it helps us to understand more clearly.


-Last, an algorithm, which is a step-by-step depiction of a solution to a

given issue, is simple to grasp. In an algorithm, the problem is divided into

smaller steps. As a result, turning it into a functioning software is simpler

for the programmer. It is simple to grasp since it presents answers to a

problem step by step. It is simple to build an algorithm, convert it to a

flowchart, and then turn it into a computer programme since each step in

an algorithm has its own logical sequence, making it simple to debug.


THANK YOUU!!!

You might also like