Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Approximations of π wikipedia , lookup
Large numbers wikipedia , lookup
Elementary mathematics wikipedia , lookup
Big O notation wikipedia , lookup
Functional decomposition wikipedia , lookup
Numerical continuation wikipedia , lookup
Factorization of polynomials over finite fields wikipedia , lookup
LECTURE – 4 TO 6 The System Development Life Cycle (SDLC) involves Six Stages: (a) Analysis (b) Design (c)Coding i.e, Programming (d) Testing (e)Launch (f) Evaluation The Analysis involves study of the existing system and the problem identification (which is beyond the scope of our course). In our present course we will be doing the stage two, three and four of the SDLC. The Design phase involves two steps : (i) (ii) Development of an Algorithm – which is nothing but defining the Process (Method). Development of Flow Chart – which is nothing but Pictorial representation of the Process Flow. We also call it Process Flow Diagram. In our syllabus we give the problem and our aim is to develop Algorithm and Flowchart for the given problem: Before going further, we shall now understand the symbols used : + : Addition - : Subtraction * : Multiply (You should not use X) / : Divide % : Modulo Division ^ : Exponent (e2 to be written as e ^2 and so on) & : Amberson And / Logic And = : Assignment operator (say x = 5 etc) The System evaluates Left to Right with order of Precedence as under: (1) Brackets (2) Exponents (3) Modulo Division (4) Divide and Multiply (5) Addition and Subtraction Example : Evaluate : 2 +3 * (5-2) * 2^3/12 Sol: First Bracket is evaluated = 2 + 3 * 3 * 2 ^ 3 / 12 Now exponent is evaluated = 2 + 3 * 3 * 8 / 12 Now Multiply and Divide are evaluated = 2 + 72/12 Now Add symbol is evaluated. =2+6 =8 (Note : Assignment and Homework Problems will be sent separately) Flow chart symbols: Start / End : Input / Output : Assignment / Calculations : Decision (Yes / No – Logical T/F) : Note : The following Algorithms and Flowchart will be used for Design of Forms, Development of Programs etc. Qn1: Develop and Algorithm and draw flow chart to find the average of three given numbers A, B, C. Sol: Here the user first has to decide the variables required. 1. The developer has to declare three variables for input say A, B and C. 2. Then there should be a variable for storing the Answer say Avg. 3. The formula one should know, ie., Avg = ∑ Xn / general formula where n is the number of items. n (this is Algorithm: Step1: Input A, B, C, Avg Step2: Find Avg = (A+B+C)/3 Flow Chart: START Step3: Write Avg Step4: Stop - Close the Program INPUT A, B,C, AVG AVG = (A+B+C)/3 WRITE AVG STOP Qn : 2 To find the Area of a Triangle given three sides A, B, C using the Heron’s Formula: Area = (S * (S-A) * (S-B) * (S-C) ) ^ (1/2) Where S = (A+B+C)/2 i.e., Semi Perimeter Solution: Algorithm: Step1: Input A, B, C, S, Area Step2: Find S = (A+B+C)/2 Flow Chart: START Step3: Find Area using the Formula Area = (S*(S-A)*(S-B)*(S-C))^(1/2) Step4: Write Area Step 5: Stop - Close the Program INPUT A, B,C, AVG S = (A+B+C)/2 Area = (S*(S-A)*(S-B)*(S-C))^(1/2) WRITE Area STOP Qn 3: To find the greatest of three numbers A, B, C: Solution: Algorithm: Step1: Input A, B, C, Ans Step2: If A> B Ans = A else Ans=B Flow Chart: Step3: If C > Ans, Ans = C Step4: Write Ans Step 5: Stop - Close the Program START INPUT A, B,C A >C A IS BIG A > B B > C B IS BIG C IS BIG STOP HOME WORK 1. Develop an Algorithm and Flowchart to find the Simple Interest (I) for given Principal (P), Rate of Interest (R), Time (T) using the formula I = (P * R * T) / 100 2. Develop and Alogrithm and Flowchart to find the Amount Payable on Principal (P), Rate of Interest (R), Time (n) where interest is compounded annually using the formula A = P + (1 +r/100)^n and also the Interest using the formula I=A–P 3. Develop an Algorithm and Flow chart to find the smallest of three numbers A, B, C 4. To find the Surface Area of a Cuboid using the formula S = 2 * (l*b + b * h + l * h) *** (Algorithm and Flowchart for control structures and Looping will be sent)