Algorithms in Business Problem Solving, Exercises of Mathematics

The role of algorithms in computer science and software programming, particularly in solving business problems. It provides a definition of algorithms, their characteristics, advantages, and disadvantages. The document then delves into the concept of business problems, the steps for problem-solving using algorithms, and the process of analyzing, developing, and implementing algorithms to address these problems. It also discusses the use of c# programming language and the compilation process of c# code. The document aims to provide a comprehensive understanding of how algorithms can be leveraged to tackle real-world business challenges effectively.

Typology: Exercises

2022/2023

Uploaded on 08/11/2024

to-me
to-me 🇭🇰

1 document

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 1: Programming
Submission date Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name Student ID
Class Assessor name
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P1 P2 M1 D1
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Algorithms in Business Problem Solving and more Exercises Mathematics in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Student ID Class Assessor name Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Grading grid P1 P2 M 1 D

❒ Summative Feedback: ❒ Resubmission

Feedback: Grade: Assessor Signature: Date: Lecturer Signature:

  • Table of figures...........................................................................................................................
  • I. Introduction..........................................................................................................................
  • II. Algorithm............................................................................................................................
    • 2.1 Definition of algorithm................................................................................................
    • 2.2 The characteristics of an algorithm..............................................................................
    • 2.3 Advantages and disadvantages of algorithm................................................................
  • III. Business problems............................................................................................................
    • 3.1 Definition of business problems................................................................................
    • 3.2 Steps for problem solving..........................................................................................
    • 3.3 Analyzing the problem................................................................................................
    • 3.4 Developing an algorithm.............................................................................................
    • 3.5 Coding.........................................................................................................................
    • 3.6 Testing and Debugging...............................................................................................
    • 3.7 Solve business problems by algorithms.....................................................................
    • 3.8 Analyze the problem..................................................................................................
    • 3.9 Library.........................................................................................................................
    • 3.10 Variables and data types..........................................................................................
  • IV. Analyze flowcharts............................................................................................................
    • 4.1 Flowchart of water bill calculation problem..............................................................
    • 4.2 Algorithm (Pseudo code)...........................................................................................
    • 4.3 Input Process Output...................................................................................................
    • 4.4 SDLC and source code...............................................................................................
  • V. Evaluation problem.............................................................................................................
  • Figure 1. What is algorithm?...................................................................................................... Table of figures
  • Figure 2. Properties of algorithm................................................................................................
  • Figure 3. Shapes or symbol to draw flow charts.........................................................................
  • Figure 4. Flowchart to calculate square of a number..................................................................
  • Figure 5. Code to calculate the sum of two numbers................................................................
  • Figure 6. The result of the algorithm to find the square of a number.......................................
  • Figure 7. Step for problem solving...........................................................................................
  • Figure 8. Operation diagram of the program............................................................................
  • Figure 9. Variables and data types............................................................................................
  • Figure 12. Flowchart Input Process Output..............................................................................
  • Figure 1 3 C# code compilation................................................................................................

I. Introduction The term algorithm comes from the Persian mathematician Muhammad ibn Mūsā al- Khwārizmī, one of the fathers of algebra, more than a millennium ago. Algorithm is a concept of Mathematics and Informatics. Researching algorithms plays a very important role in computer science in general or software programming in particular. My report will provide a definition of what an algorithm is and outline the process of building an application. My article includes 4 parts:

  • First I need to provide an overview of the Algorithm with features, illustrations, explanations and examples. Next, I will present a small and simple problem like writing a function to calculate water bills of households, customers, etc. why that problem needs to be solved and how algorithms can help to solve it. You should write pseudocode and draw diagrams to represent the algorithm. why it needs to be solved and how algorithms can help solve it.
  • Second, I will analyze the coding process and translate it into application requirements
  • Third, you must demonstrate compiling and running a program , how the application is implemented using an appropriate programming language.
  • Finally, I will evaluate how to solve the problem from the designed algorithm to the executable program written in a specific programming language. II. Algorithm The concept of algorithms has existed since ancient times. Arithmetic algorithms, such as the division algorithm, were used by ancient Babylonian mathematicians around 2500 BC and Egyptian mathematicians around 1550 BC. Greek mathematicians later used the sieve of Eratosthenes to find prime numbers, and the Euclidean algorithm to find the greatest common divisor of two numbers. Arab mathematicians such as al-Kindi in the 9th century used cryptographic algorithms to break codes, based on frequency analysis. Especially in today's life, everyone knows that algorithms are an important thing in our lives. But how important is it to understand it? Or in the way that many people ask the question "how much can we know about algorithms", in this report we will learn more deeply about what an algorithm is?

2.2 The characteristics of an algorithm..............................................................................

In algorithms there are 5 properties for an algorithm, these properties are: Figure 2. Properties of algorithm 1.Input: The algorithm receives input data from a certain set. 2.Output: From input data, the algorithm will calculate and give results corresponding to that input.

  1. Definiteness: Each step of an algorithm must be precisely defined. An algorithm must be unambiguous and clear. Each step of algorithm and input/outputs must be clear. There is only one meaning of each step of algorithm. 4.Finiteness: Finiteness The algorithm must end after a finite number of steps. 5.Effectiveness: An algorithm should have step-by-step instructions, which should be independent of any programming code. For example, below is an algorithm for finding divisors of a positive integer N written in a function int count_divisors(int N)

int divisors = 0 ; for (int i = 1 ; i <= N; ++i) if (N % i == 0 ) ++divisors; return divisors; }

2.3 Advantages and disadvantages of algorithm................................................................

Advantages of Algorithm:  Easy to enderstand and install: The Selection sort algorithm is very esy to understand and does not require much complicated knowledge.  Does not require additional memory: Selection Sort does not use additional memory beyond the original array, so it doé not comsume additional resources.  Simple and performs few comparisons: This algorithm only needs to perfrom (n-1) comparisons to sort (n) elements, with (n) being the number of elements in the array. Defect of Algorithm:  Time complexity: Selection Sort has a time complexity of O(n^2), where (n) is the number of elements in the array. This makes the algorithm slower than some other sorting algorithms such as Quick Sort or Merge Sort.  Not optimizable: This algorithm cannot be optimized using techniques such as “early exit” or “adaptive sorting” to reduce the number of comparisons.Algorithm for Simple Problem Flowchart is used to illustrate the algorithm. So what is a block diagram? A flowchart is a visual representation of an algorithm. A flowchart is a diagram made up of boxes, diamonds, and other shapes, connected by arrows. Each shape represents a step of the solution process and the arrows represent the order or link between the steps and they contain symbols as shown below

Figure 4. Flowchart to calculate square of a number Begin Enter 2 integers a,b Count: Total=a+b End export total

The program below requires the user to enter a value. After receiving the value from the user, it will sum the two numbers entered. Figure 5. Code to calculate the sum of two numbers And the result: Figure 6. The result of the algorithm to find the square of a number

Figure 7. Step for problem solving

3.3 Analyzing the problem................................................................................................

Problem analysis is important when we start looking for a solution to it clearly and we are not clear what is going to be solved, because we may end up developing a program that does not solve the problem. our purpose. So, we need to read and analyze the problem statement carefully and decide what functionalities our solution should have. By analyzing a problem, we will be able to find out the inputs to the program and what outputs the program will produce and execute.

3.4 Developing an algorithm.............................................................................................

Algorithm development is the process of creating a set of specific rules, instructions, or steps to solve a problem or perform a specific task on a computer, and it is necessary to find the solution first. when writing program code for a given problem. That solution is expressed in machine language and is called an algorithm.

3.5 Coding.........................................................................................................................

Encryption is a method of converting information in its normal form to become incomprehensible without a means of decoding. More simply, encryption is a way to scramble data in a messy way that only the two parties exchanging information can understand. So After completing the algorithm, we need to convert the algorithm into a form that the computer can understand to give the desired solution. 3.6 Testing and Debugging The program created should be tested on various parameters. The program should meet the requirements of the user. It must respond within the expected time. It should generate correct

output for all possible inputs. In the presence of syntactical errors, no output will be obtained. In case the output generated is incorrect, then the program should be checked for logical errors, if any. Software industry follows standardized testing methods like unit or component testing, integration testing, system testing, and acceptance testing while developing complex applications. This is to ensure that the software meets all the business and technical requirements and works as expected. The errors or defects found in the testing phases are debugged or rectified and the program is again tested. This continues till all the errors are removed from the program. Once the software application has been developed, tested and delivered to the user, still problems in terms of functioning can come up and need to be resolved from time to time. The maintenance of the solution, thus, involves fixing the problems faced by the user, answering the queries of the user and even serving the request for addition or modification of features.

3.7 Solve business problems by algorithms.....................................................................

To be able to understand more about the algorithm and its details. I will apply an algorithm to solve a problem like this: A teacher wants to manage the final grades of students in the class. He needs to print out the ranking of the students, calculate the average score of the students and calculate the pass rate of the students. The program needs to enter student information, student IDs and grades. After entering the information, the program needs a Menu so that he can use the functions as a After read clearly the scenario, I solved it by using an algorithm based on C# language to create a program must have full option that satisfy the requirement of teacher. C# is a general object-oriented programming (OOP) language for networking and Web development. C# is specified as a common language infrastructure (CLI) language. In January 1999, Dutch software engineer Anders Hejlsberg formed a team to develop C# as a complement to Microsoft’s NET framework. Initially, C# was developed as C-Like Object Oriented Language (Cool). The actual name was changed to avert potential trademark issues. In January 2000, NET was released as C#. Its NET framework promotes multiple Web technologies. Here, we need to create an application to enter name, score, ID above.

3.8 Analyze the problem..................................................................................................

To solve the above problem, we need the Input and Output integration of the problem. Here, the teacher will enter the student's information and ask the program to print out the student rankings, the grade point average of the class and the passing rate of the students. So, we can summarize the input and output as follows:

  • Input: Student's information including ID, name and grade.
  • Output: Ranking, GPA and pass rate of students in the class.

Basic library of a Console Application, using commands like Console.Writeline (), Console.Readline(), conditional structure, etc.

3.10 Variables and data types..........................................................................................

When working with variables and data types in C#, I have a few ways to solve problems that you can apply: 1.Declaring variables and assigning values:

  • Use the var keyword to declare variables and assign values to them. For example:
  1. Check data type:
  • Use conditional statements such as if, switch to check the data type of the variable. For example:
  1. Casting:  Use cast operations to convert between data types.  For example:

Figure 9. Variables and data types IV. Analyze flowcharts

4.1 Flowchart of water bill calculation problem..............................................................

  • To calculate water bill we need to know the number of cubic meters of

water used. The user enters the water index at the end of last month and

the water index at the end of this month from which we can calculate the

number of cubic meters of water used by subtracting the amount of water

from this water index. index last month. The General flow chart will be as

follows:

  • In this case, when entering values such as customer name, last month's and this month's water bills or water consumption data, the following conditions must be met:  water indices must be positive integers.  previous month's index must be smalle or equal to this month.
  • If the conditions on the screen are incorrect, an error will be reported. Figure11. Flowchart of input data
  • In the flow chart, the user is required to divide this type of customer into 2 main branches including household water bills and the remaining customers. -First, households are divided into 4 cases with conditions satisfied with c being the price ratio:  case 1: if c>0 and c<10, the screen displays the water bill price according to the formula "price=c5.973".  Case 2: if c>10 and c<=20, the screen prints the water bill price according to the formula "price=c7.052".  Case 3: if c>20 and c<=30, the screen prints the water bill price according to the formula "price=c8,699".  case 4 price does not satisfy the conditions of the previous 3 cases, it will be calculated according to the formula "price=c15,929". Figure12. Water bill calculation diagram for households
  • The water bill calculation diagram for customers is divided into 3 types: