a

© All Rights Reserved

0 views

a

© All Rights Reserved

- DesignJet 1050 Main PCA Replacement
- Strategic Intervention Material in Mathematics Grade 7
- Sdmo Kerys Control Panel Manual
- Hkimo 2018 Practice Paper g3
- Phabsim Manual
- RTC Reference Manual
- pure energy assembly maintenance operation
- readme_en
- lego arrays
- C# Operators
- Moto Q Field Service Manual
- vi editor
- Finding Sums
- Finding Sums
- Learning Hierarchy
- DGPLSN4S-EU00
- SWG2013
- health lesson plan brittany norton
- evans wordproblems
- ML-2 - Operators Manual

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.

- DesignJet 1050 Main PCA ReplacementUploaded byDean Stacey
- Strategic Intervention Material in Mathematics Grade 7Uploaded byArlene M. Callang
- Sdmo Kerys Control Panel ManualUploaded byZekai Yurtman
- Hkimo 2018 Practice Paper g3Uploaded byCareen Sancho-Alicaway
- Phabsim ManualUploaded bySergei HG
- RTC Reference ManualUploaded byRobinson Ospina
- pure energy assembly maintenance operationUploaded byPaulmanke
- readme_enUploaded byfelipegaga
- lego arraysUploaded byapi-317374789
- C# OperatorsUploaded bybalakrishna3
- Moto Q Field Service ManualUploaded byViswanath Mahadas
- vi editorUploaded byrajesh_junk
- Finding SumsUploaded byDigi-Block
- Finding SumsUploaded byDigi-Block
- Learning HierarchyUploaded byLacey Conde
- DGPLSN4S-EU00Uploaded byJoel Abad Pulache
- SWG2013Uploaded byMiguel Oliveira
- health lesson plan brittany nortonUploaded byapi-301939125
- evans wordproblemsUploaded byapi-306448155
- ML-2 - Operators ManualUploaded byCatalin Pelin
- sshr.pdfUploaded byFerasHamdan
- Sage X3 - User Guide - HTG-Customer Search.pdfUploaded bycaplusinc
- Biometric AMS User ManualUploaded byrahul1389
- Infotype menu Configuration Steps SAP HR - SAP Training Tutorials.pdfUploaded byMrinal Kanti Das
- Yealink SIP IP Phones Configuration Guide for User Access Level V80 60Uploaded bytitiduru
- RC 2014 AutoCAD ManualUploaded byJose Luis Elizarraras
- API-1000-11_Rev_0Uploaded by213ekno
- En ACS850 Control Panel UG AUploaded bycuongvcs
- L_PRO_4000_manual.pdfUploaded byDBachai84
- rphUploaded bySJK(T) CHETTIARS

- TSU Computer Lab LocationsUploaded byNaeem Gul
- MATlab2Uploaded byNaeem Gul
- RAM2Uploaded byNaeem Gul
- Peer ReviewUploaded byNaeem Gul
- 4. Needs Assessment TemplateUploaded byChelsea Log
- docx.docxUploaded byNaeem Gul
- AircraftUploaded byNaeem Gul
- presentationUploaded byNaeem Gul
- WordsworthUploaded byNaeem Gul
- powersystemcode.txtUploaded byNaeem Gul
- Download 12Uploaded byNaeem Gul
- projec02.txtUploaded byNaeem Gul
- A_Project_Based_Lab_Report_On_STREET_LIG.docxUploaded byNaeem Gul
- The Purchasing Selection of a Decision Making Uses AHP (1)Uploaded byNaeem Gul
- UnUploaded byNaeem Gul
- Zora Neale Hurston PowerPointUploaded byNaeem Gul
- NotesUploaded byNaeem Gul
- Example ExamUploaded byNaeem Gul
- kp=0.025Uploaded byNaeem Gul
- 50 Qfd Powerpoint TemplateUploaded byNaeem Gul
- communication notesUploaded byNaeem Gul
- Curso Dash okUploaded byjordanbigjay
- EECE3500-note_05 (3)Uploaded byNaeem Gul
- History__asdUploaded byNaeem Gul
- 12Uploaded byNaeem Gul
- LicenseUploaded byArias D. Cristian
- Presto 4Uploaded byNaeem Gul
- Space Shuttle LaunchUploaded byvinod

- APRSF-24 ConceptPaperUploaded byKiran Kumar
- A Critical Study of Financial Administration and Its Managerial Efficiency in Business EnterpriseUploaded byLekan Allen
- Airway Management -Basics 2012.pptxUploaded byGuliga Niculina
- CW2Uploaded bySteve Cowan
- Switchgear developments for IMEUploaded byhbahirat
- Lifting Code of PracticeUploaded byOnaFajardo
- Duncan_Flett_Safety_ResumeUploaded byOsyn Kh
- Master Closed BookUploaded byMike Adrian Cerbito
- ICU Medical, Inc. v. Rymed Technologies, Inc., C.A. No. 07-468-LPS (D. Del.)Uploaded byYCSTBlog
- aas pdfUploaded byapi-355808066
- IDEA (2)Uploaded byaannkkiitt
- Schaum's Outline of Electromagnetics, Second EditionUploaded byEhtesham Showmo
- Copy of Indzara Project Planner Basic v3 1 SampleUploaded byYudith Rachmadiah
- Baire Cat TheoremUploaded byKamil
- 2014bc ExcavationUploaded byrjsquebrar
- Silica CheckUploaded byAh Sulaeman Al-Adhyim
- Airtel Prepaid Recharge Online _ Prepaid Mobile Tariffs PlansUploaded byAbdur Rahman
- 3_Queue.pptUploaded byLuiza-Elena Mandici
- UntitledUploaded byapi-274468947
- Foriegn Collabration TypesUploaded byKarmjit Kaur
- HRM in a GlanceUploaded byVineet Justa
- Algebra in Elementary School Developing Relational ThinkingUploaded byGreySi
- annotated bibliographyUploaded byapi-455791623
- Airtel BillUploaded bysonuindia88
- Finite Element Analysis of Static Wing Box Test RigUploaded byInternational Journal of Research in Engineering and Technology
- Ticket Genration Using QRUploaded byGanesh Warang
- ehv051Uploaded byNovit nf
- b94af853-4d99-421f-9e7e-a41e1156da93Uploaded byJessica McBride
- print vs electronicUploaded byTabish Ahmed
- Alv Templet (Using Oops)Uploaded byKishan Cp

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.