Vous êtes sur la page 1sur 6

Last Name SAN JOS STATE UNIVERSITY

First Initial

Department of Mechanical and Aerospace Engineering

ME 30 Computer Applications Lab Project Report Cover Sheet


Date 1/30/2013 Noone
Last Name

Proj. #

Name (print) Partners (if any) Project # Summary 1`

Komal Chakravarthi
First Name

03
Lab Section

Title

Developing an algorithm and geeting started with ch

During the course of this lab I learned various concepts like Algorithm, Pseudocode, flowchart, various symbols for drawing flowcharts. I also learned sequences, selections and repetitions. At the end of the lab there was an example of a flowchart incorporating all the aspects that were learned in the lab. Algorithm: A series of ambiguous operation that when executed will produces the desired results. Pseudocode: A recipe of sorts that can guide the programmer in creating an algorithm. Flowchart: A visual representation of the algorithm in a well placed order so that the final program can be visualized b the programmer. Sequence: A sequence is a series of steps that are executed on after the other. Selection: A Selection gives the user a choice to do the problem in different ways using IF, IF-ELSE, SWITCH. Repetition: A repetition is a repetition to a certain number of steps in the algorithm that is done over and over again until the desire condition is fulfilled. WHILE, DO-WHILE,FOR are sued to do this.

BJ Furman | ME 30 Computer Applications | lab_rpt_tpt.doc | 29JAN2011

Page 1 of 6

Last Name SAN JOS STATE UNIVERSITY

First Initial

Department of Mechanical and Aerospace Engineering

ME 30 Computer Applications
No. 1.1

Proj. #

Problem Description (brief) To consider a pseudocode prompt the user to enter two numbers and produce the num that is the greater of the two.

Solution

a) If the numbers entered are 12 and 27 then the printed number will be 27 since 12 is not greater
than 27. Yes, the algorithm will produce the correct result b) If the numbers entered are 27 and 12 then the since 27 is greater than 12.Yes, the algorithm will produce the correct result

c) If the numbers entered are 27 and 27 then the printed number will be .the algorithm will produce
an incorrect result. d) . 1. Prompt user to enter two numbers, num1 and num2. 2. Get the two numbers entered by the user. 3. IF num1 is greater than num2, THEN 3.1 PRINT num1 is greater 4.ELSE 4.1 PRINT num2 is greater 5. IF num1 and num2 are equal ,THEN 5.1 PRINT both the nums are equal.

Verification of Solution (if applicable)

BJ Furman | ME 30 Computer Applications | lab_rpt_tpt.doc | 29JAN2011

Page 2 of 6

Last Name SAN JOS STATE UNIVERSITY

First Initial

Department of Mechanical and Aerospace Engineering

ME 30 Computer Applications
No. 1.2 Create a flowchart for the algorithm from 1.1.
Solution
START

Proj. #

Problem Description (brief)

num1=0

num2=0

IF num1>num2

IF num1=num2

ELSE

PRINT num1

PRINT both the numbers are equal

PRINT num2

STOP

Verification of Solution (if applicable)

BJ Furman | ME 30 Computer Applications | lab_rpt_tpt.doc | 29JAN2011

Page 3 of 6

Last Name SAN JOS STATE UNIVERSITY

First Initial

Department of Mechanical and Aerospace Engineering

ME 30 Computer Applications
No. 2.1 Write a procedural algorithm in pseudocode for determining how much money will be owed at the end of a month for the electricity usage.
Solution Problem Description (brief)

Proj. #

1. Usage = 0
2. Prompt user to enter Level. 4. IF customer is Level 1 then 4.1 IF Usage > 200 kWhr Then 4.1.1 (Usage-200)* $0.17 per kWhr +(200*0.12) 4.1.2 Else 4.1.3 Usage* $0.12 per kWhr 5. IF customer is Level 2 then 5.1 IF Usage > 300 Then 5.1.1 (Usage-300)* $0.17 per kWhr + (300*0.12) 5.1.2 Else 5.1.3 Usage* $0.12 per kWhr

Verification of Solution (if applicable)

No.

2.1

BJ Furman | ME 30 Computer Applications | lab_rpt_tpt.doc | 29JAN2011

Page 4 of 6

Last Name SAN JOS STATE UNIVERSITY

First Initial

Department of Mechanical and Aerospace Engineering

ME 30 Computer Applications
Problem Description (brief)

Proj. #

Write a procedural algorithm in pseudocode for determining how much money will be owed at the end of a month for the electricity usage.

ST

Verification of Solution (if applicable)

No.

3.1

BJ Furman | ME 30 Computer Applications | lab_rpt_tpt.doc | 29JAN2011

Page 5 of 6

Last Name SAN JOS STATE UNIVERSITY

First Initial

Department of Mechanical and Aerospace Engineering

ME 30 Computer Applications
Problem Description (brief)

Proj. #

Algorithm: 1. Prompt user to enter ten numbers, num1, num2, num3, num4, num5, num6, num7, num8, num9, num10. 2. Take the Initial value as 0. 3. Sum the given numbers. 4. Print the result. 1. START 2. num1= 0 , num2 = 0 , num3 = 0 , num4 = 0 , num5 = 0 , num6 = 0 , num7= 0 , num8 = 0 , num9 = 0 , num10 = 0 . 3. Sum = 0. 1. REPEAT 2. 4.1 Increment the Variable N 3. N=N+1; 4. 4.2 Adding the terms to the Variable for Sum 5. Sum= Sum+N; 6. UNTIL N=50 7. PRINT Sum; 8. END 9. 10.

ST

Verification of Solution (if applicable)

BJ Furman | ME 30 Computer Applications | lab_rpt_tpt.doc | 29JAN2011

Page 6 of 6

Vous aimerez peut-être aussi