Add to Favorites    Make Home Page 19231 Online  
 Language Categories  
 Our Services  

Home » COBOL Home » COBOL Projects Home » COBOL ON-SCREEN CALCULATOR (Mini Project)

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title COBOL ON-SCREEN CALCULATOR (Mini Project)
Author Stephen Rendell
Author Email stephen [at] hcsd.com.au
Description written in RM-COBOL 77 .. (OK with Cobol85) to implement a simple on-screen calculator.

Category COBOL » COBOL Projects
Hits 20912
Code Select and Copy the Code
Code : IDENTIFICATION DIVISION. ooo PROGRAM-ID. CALC. *----------------------------------------------------------------- ooo * THIS IS CALCULATOR OVERLAY *----------------------------------------------------------------- ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. RMC-UNIX. OBJECT-COMPUTER. RMC-UNIX. DATA DIVISION. WORKING-STORAGE SECTION. 01 COMMON-DATA. 02 OPERATOR-NUMBER PIC 9(06) VALUE 1. 02 DISP-AMT PIC Z(8).99-. 02 NEW-VALUE PIC S9(8)V99. 02 ACCUMULATOR PIC S9(8)V99. 02 KEYPRESS PIC X. 88 CLEAR-ACCUMULATOR VALUE IS "C". 88 ENDING VALUE IS "Q". 88 VALID-KEY VALUES ARE "+", "*", "/", "-". 01 LIN PIC 99 COMP. PROCEDURE DIVISION. BEGIN. DISPLAY "*** SYSTEM CALCULATOR ***" LINE 1 POSITION 25 ERASE "Uses + - / * C=Clear Q=Quit" LINE 2 POSITION 25. MOVE 4 TO LIN. MOVE 0 TO ACCUMULATOR. DISP-ACCUM. MOVE ACCUMULATOR TO DISP-AMT. DISPLAY "Accumulator" LINE LIN POSITION 2 DISP-AMT LINE LIN POSITION 14 "." LINE LIN POSITION 27 " Function +-/*C" LINE LIN POSITION 29. ACCEPT KEYPRESS LINE LIN POSITION 27 PROMPT ECHO. DISPLAY " " LINE LIN POSITION 29 ERASE EOL. IF CLEAR-ACCUMULATOR GO TO BEGIN. IF ENDING GO TO END-CALC. IF NOT VALID-KEY GO TO DISP-ACCUM. ACCEPT NEW-VALUE LINE LIN POSITION 30 SIZE 10 PROMPT ECHO CONVERT. MOVE NEW-VALUE TO DISP-AMT. DISPLAY DISP-AMT LINE LIN POSITION 30. IF KEYPRESS = "+" ADD NEW-VALUE TO ACCUMULATOR. IF KEYPRESS = "-" SUBTRACT NEW-VALUE FROM ACCUMULATOR. IF KEYPRESS = "*" MULTIPLY NEW-VALUE BY ACCUMULATOR ROUNDED. IF KEYPRESS = "/" DIVIDE NEW-VALUE INTO ACCUMULATOR ROUNDED. ADD 1 TO LIN. IF LIN = 22 MOVE 4 TO LIN DISPLAY " " LINE 1 POSITION 1 ERASE EOS. GO TO DISP-ACCUM. END-CALC. DISPLAY " " LINE LIN POSITION 27 ERASE EOL. EXIT-POINT. EXIT PROGRAM. FALLTHROUGH. STOP RUN.

Related Source Codes

Script Name Author
sandeep kumar singh
Learn Cobol in a Day C.KUMARESAN
my atm (Mini Project) sandeep kumar singh
Merge Two Files. Rakshith
Naveen Chandran P.K
Program of USSR naval stock list Jai Ganesh
PRIME NUMBER Grace Hill
Date Difference in Mainframe COBOL Muruganandham
Sequential File - Health Care C.KUMARESAN
Task for the day program. Rama Murthy M
FIBONACCI series Abir Pathak
PRIME NUMBER Grace Hill
Harmonic Series Abir Pathak
Cobol sequential file program. b.s.prakash
Introduction to COBOL. B.S.prakash

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions
Copyright ©2003-2017 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=924


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review