0 views

Uploaded by Naeem Gul

a

- 01_GettingStarted
- Menu exits.pdf
- ehzolkktrlqz4zzmx56e-140601231109-phpapp02
- 26338 Internet and eCommerce MarkingGridPt2
- e Hep 000698
- Senator 200 OM Manual
- Adding Menus
- math observed lesson template
- MP4 user manual.pdf
- SURPAC Introduction Demonstration
- Apostila Robot 2010 - Getting Started Guide.pdf
- Formatting
- Glossary of Backstage View Terms
- A320 Digital Multimedia Player
- Introduction to Maya
- Becker 7949 Traffic Pro Operation Guide (English, Spanish, Portuguese)
- SYLLABUS for MAT091 Basic Math Skills
- Folsom Encore Presentation System
- HSSD installers_handbook.pdf
- patran2004

You are on page 1of 10

Problem definition

Develop a menu-driven program that inputs two numbers and, at the user’s option, finds their

sum, difference, product, or quotient. Make sure that your program gives an error message in

1. Add

2. Subtract

3. Multiple

4. Divide

Conversion program

1. Sum of A and B

2. Subtract B from A

3. Multiple of A and B

4. Divide A by B

Please enter your selection:

II. Analysis

Before we start designing the program, we designate three things, which are what are the

Frist of all, we need to find out all the input data we have. It is a menu-driven program, so

user has to choose one of four menu options. That would be the first input data on problem

statement. Once user selects an option, the input data will be selected depending on what

menu user choose such as the two numbers for sum, the two numbers for subtract, the two

numbers for multiple and the two numbers for divide. All these values are not specified, thus

Secondly, we need to find out all the output data that we will have. The output data will

be the result value of user’s selection. For example, if the user chooses the case one menu,

which is add operation, the output will be the result of add operation, so as the other three

menus.

Finally, we need to identify how to use input data to get output data. The program is able

1. A + B

2. A - B

3. A * B

4. A / B

One thing that we have to make sure that the second value, which is B, on the case four

menu, cannot be zero because any number cannot divide by zero. We will need to show the

III. Design

We need to identify the input and output data to set up the pseudocode. The five input data

will be the user’s menu selection and the four operations. We named the five inputs as

menuselection for the user’s selection, the two number, A and B for add operation, the two

number, A and B for subtract operation, the two number, A and B for multiple operation, and

the two number, A and B for divide operation. Simply, we use A and B for the four menu, but

the output will be different depending on what menu user choose. Also, the output data will

be the result value of the input, which is menu selection. There will be the four output data

from the four input data like: resultsum, resultsubtract, resultmultiple, and resultdivide.

We divide three modules to run this program, which are display module to let user select the

menu, perform calculate module to process the operation from the selection of menu and with

two numbers that user typed, and output module to show the result of operation.

Since we have all named input and output data, we can start design the program. This is

Main module

//Declare input and output data

Declare menuselecition as integer

Declare A as integer

Declare B as integer

Declare resultsum as integer

Declare resultsubtract as integer

Declare resultmultiple as integer

Declare resultdivide as integer

//Display purpose of this program

Output “This program shows the result of sum A and B,”

Output “subtract B from A,”

Output “multiple of A and B,”

Output “divide A by B”

//call three modules

Call display menu module

Call perform calculate module

Call output module

End program

Display menu module

Output “Select the operation,”

Output “1. Sum of A and B,”

Output “2. Subtract B from A,”

Output “3. Multiple A and B,”

Output “4. Divide A by B”

Output “Please choose one of operations:” input menuselection

Select case of menuselection

Case 1 : Output “Please enter the first number A” Input A

Output “Please enter the second number B” Input B

Set resultsum = A + B

Break

Case 2 : Output “Please enter the first number A” Input A

Output “Please enter the second number B” Input B

Set resultsubtract = A - B

Break

Case 3 : Output “Please enter the first number A” Input A

Output “Please enter the second number B” Input B

Set resultmutiple = A * B

Break

Case 4 : Output “Please enter the first number A” Input A

Output “Please enter the second number B” Input B

Set resultdivie = A / B

Break

Default:

Output “Option” + menuselction +“is invalid.”

End case

Output module

Case 1

Output “The first number is:” + A

Output “The second number is:” +B

Output “The result of sum A and B is:” +resultsum

Break

Case 2

Output “The first number is:” + A

Output “The second number is:” +B

Output “The result of subtract B from A is:” +resultsubtract

Break

Case 3

Output “The first number is:” + A

Output “The second number is:” +B

Output “The result of multiple A and B is:” +resultmultiple

Break

Case 4

Output “The first number is:” + A

Output “The second number is:” +B

Output “The result of divide A by B is:” +resultdivide

Break

End case

1 453 25 478

2 752 23 729

3 52 4 208

4 85 6 14.16667

4 157 0 Error!

For the last test data, we will not have output data because we cannot be able to divide by

zero.

V. Flow chart

1. Main module

2. Display menu module

3. Perform calculate module

4. Output module

VI. Testing

This is the result by using test data. There were a couple errors when user enter wrong value,

which is that zero was typed on case 4, divide operation, and when user select the other number

When user enter zero for the case 4 operation, the error message show up and say “Can’t divide

by zero”. Also, the display show that the any number can’t divide by zero

Another error is that user chooses wrong number for the menu selection. We already set it up on

pseudocode that if the number is not selected, than it goes to invalid menu.

- 01_GettingStartedUploaded byKishore Chandra Uppadi
- Menu exits.pdfUploaded byPhogat
- ehzolkktrlqz4zzmx56e-140601231109-phpapp02Uploaded byনীল জোছনা
- 26338 Internet and eCommerce MarkingGridPt2Uploaded byyzwrdkyh
- e Hep 000698Uploaded byShane Brown
- Senator 200 OM ManualUploaded byJose Leandro Gomez Yuste
- Adding MenusUploaded byRenz Oraliza
- math observed lesson templateUploaded byapi-431084721
- MP4 user manual.pdfUploaded byMarko Mujan
- SURPAC Introduction DemonstrationUploaded bylodewijkeco
- Apostila Robot 2010 - Getting Started Guide.pdfUploaded byjefersonpimentel
- FormattingUploaded bySaikiran Sayabugari
- Glossary of Backstage View TermsUploaded byJenica Loreen Santos
- A320 Digital Multimedia PlayerUploaded byWilloughby
- Introduction to MayaUploaded byChaitanya Singumahanti
- Becker 7949 Traffic Pro Operation Guide (English, Spanish, Portuguese)Uploaded byMatt Sephton
- SYLLABUS for MAT091 Basic Math SkillsUploaded byIan Bernales Orig
- Folsom Encore Presentation SystemUploaded byAdrian Gardner
- HSSD installers_handbook.pdfUploaded bypurwanto_tfits
- patran2004Uploaded byJongdae Choi
- FWP_REFUploaded byMarcos Martinez Avila
- SAP Nav Assessment AnswersUploaded byShree Nivas
- Changing Client SettingsUploaded byVivek Kumar Polurouthu
- User Exits and Customer Exits in SAP ABAPUploaded byAnjan Kumar
- Adding Integers DI - AUploaded byLAURA
- Exemplar What's the ProblemUploaded bynist6jk
- CO Key User TrainingUploaded byFared Islam
- cis221lessonplan-kidspirationUploaded byapi-273795796
- MTPQSM072916Uploaded bypfalencar
- flash-quick-reference-cs3.pdfUploaded byJennifer Mcbride

- WordsworthUploaded byNaeem Gul
- AircraftUploaded byNaeem Gul
- docx.docxUploaded byNaeem Gul
- A_Project_Based_Lab_Report_On_STREET_LIG.docxUploaded byNaeem Gul
- UnUploaded byNaeem Gul
- Chap 003Uploaded byNaeem Gul
- Ex.3_KCM[1]Uploaded byNaeem Gul
- presentationUploaded byNaeem Gul
- Download 12Uploaded byNaeem Gul
- licence.txtUploaded byNaeem Gul
- The Purchasing Selection of a Decision Making Uses AHP (1)Uploaded byNaeem Gul
- uncert.xlsxUploaded byNaeem Gul
- Hw.4Uploaded byNaeem Gul
- projec02.txtUploaded byNaeem Gul
- powersystemcode.txtUploaded byNaeem Gul
- History__asdUploaded byNaeem Gul
- Curso Dash okUploaded byjordanbigjay
- 50 Qfd Powerpoint TemplateUploaded byNaeem Gul
- NotesUploaded byNaeem Gul
- EECE3500-note_05 (3)Uploaded byNaeem Gul
- 4. Needs Assessment TemplateUploaded byChelsea Log
- Error CorrectionUploaded byNaeem Gul
- ConceptdevelopmentUploaded byNaeem Gul
- Zora Neale Hurston PowerPointUploaded byNaeem Gul
- 12Uploaded byNaeem Gul
- communication notesUploaded byNaeem Gul
- kp=0.025Uploaded byNaeem Gul
- sUploaded byNaeem Gul
- Example ExamUploaded byNaeem Gul

- NAMMCESA_000022.pdfUploaded byBasel Osama Raafat
- Reynolds Number Effects on an Adverse PressureUploaded byFerri Aguswan
- Exchange Server 2003Uploaded byjavedjshaikh14
- edu 699 final paper final draftUploaded byapi-324235159
- Oracle Financials Cloud 2016 PreSalesTESTUploaded byMiguel Felicio
- EJ981457.pdfUploaded byramirali
- Fuzzy PID controllerUploaded byMadhumitha Rajasekaran
- UOP 2-12-5 Fired HeatersUploaded bykaboomi47
- complaining to paypalUploaded byAndrea Dugandžić
- Object oriented programming inheritanceUploaded byzohaib
- Arcgis Basics Labels AnnotationUploaded byangela131313
- Machine Vision System Applications.docUploaded byjiIIIIIIIIIIIIIII
- System Sensor 2151 & 2151T - Installation ManualUploaded byAlarm Grid Home Security and Alarm Monitoring
- social justice sculpture rubricUploaded byapi-312657832
- Gst 307Uploaded bytesserl
- PhD++Thesis_RuiMSMartinsUploaded byAna Claudia Machado
- TRGaN.pdfUploaded bystepannp
- 4T03 Site Handover Meeting Minutes v4-0Uploaded byengsam777
- CE474-Ch4-ApproximateMethodsUploaded byRodny Thomson
- Curtis-Toledo Masterline Compressor ManualUploaded byenigma917
- Director of Software DevelopmentUploaded byapi-78086144
- MVPD Presentation - 28-1-2017Uploaded byGuru Mishra
- module3-1Uploaded byAmrita Prasad
- 22. Manual TransaxleUploaded bySyed Arsalan Ahmed
- II500.50r4en - Valves General RecommendationsUploaded byHumayun Nawaz
- English AssignmentUploaded byBeny Iskandar Beny
- Sp 12 Statipower Rev 6Uploaded byนภดล สินธุแปง
- A Study on the Customers Awareness and Perception Level Towards Green CarsUploaded byjj20thomson
- Kurt Cobain Jaguar Specs WiringUploaded byPedro Andrade
- t90.2023enUploaded byBly Fett