SlideShare a Scribd company logo
1 of 23
OBJECT ORIENTED PROGRAMMING
(ii)
Java Final Project
Creating Scientific Calculator
Team Members
Name Exam Roll
Class Roll
1. Md. Eunus Ali Rupom 140135 24
2. Md. Sujan Bhuiyan 140149 38
3. Md. Sejan Ahmed 140150
39
Features
Arithmetic Functions Geometric Functions Memory
Functions
1. Addition 1. Sine
1. Memory Save
2. Subtraction 2. Cosine
2. Memory Read
3. Multiplication 3. Tangent
3. Memory Clear
4. Division 4. Degree
5. Percentage 5. Radian
GUI Programming
Step 1 : Creating a JFrame using NetBeans IDE
Step 2 : Forming a design using drag & drop
Step 3 : Make sure all buttons are working
Step 4 : Write down the Action performed of all the components
Step 5 : Removing Bug
Step 6 : Run & Execute the programe.
Source Code Explanations
Entering variables into the Calculator Application
“ import java.math.*; //import
Statements
public class Calculate extends javax.swing.JFrame { //class Header
private boolean zerodisp,decdisp,dgrrad,sh; //private Variables Declared
private byte op; //private
Variables Declared
private double ina,inb,out; “ //private Variables
Declared
Source Code Explanations Contd...
“Calculate” Constructor was called with a function “initComponents()” to
implement it later
“ public Calculate() { //constructor
initComponents();
} “
Source Code Explanations Contd...
ActionPerformed pattern of 0-9 digits/buttons & decpoint button
private void DIGITActionPerformed(java.awt.event.ActionEvent evt) {
“ if(!zerodisp && !decdisp){
display1.setText(null);
}
display1.setText(display1.getText()+"DIGIT");
zerodisp = true;
//not for zero
} ”
here ,
function “setText(String Value)” - Sets the text displayed by the text field &
“getText(String Value)” - Obtains the text displayed by the text field.
Source Code Explanations Contd...
ActionPerformed on negate:
“private void negateActionPerformed(java.awt.event.ActionEvent evt) {
inb = Double.parseDouble(String.valueOf(display1.getText()));
out=inb * -1;
if(out > -100000000 && out < 100000000){
display1.setText(String.valueOf(out));
}else {
display1.setText("Error");}out=0; }”
Here,
Function “String.valueOf()” - Returns the string representation of the input argument &
“Double.parseDouble()”- Returns a primitive double containing the value of the string:
Source Code Explanations Contd...
ActionPerformed on Memory functions:
“private void memoryreadActionPerformed(java.awt.event.ActionEvent evt) {
display1.setText(String.valueOf(memorydisplay.getText())); //took value from memory display &
set that at display1
}
private void memoryclearActionPerformed(java.awt.event.ActionEvent evt) {
memorydisplay.setText("0"); //clears memory from memory display & set value as 0
}
private void memorysaveActionPerformed(java.awt.event.ActionEvent evt) {
memorydisplay.setText(String.valueOf(display1.getText()));}” //took value from display1 & set that at
memory display
Source Code Explanations Contd...
ActionPerformed on Arithmetic Operations & PI:
“ private void ARITHMETICActionPerformed(java.awt.event.ActionEvent evt) {
inb=Double.parseDouble(String.valueOf(display1.getText()));
out=inb*inb; //for square operation
/* out = inb*inb*inb for cube operation
* out = Math.sqrt(inb) for square root operation
* out=Math.cbrt(inb) for cube root operation
* out=1/inb for 1 dividev by X */
if(out > -100000000 && out < 100000000){
display1.setText(String.valueOf(out));
} else {
display1.setText("Error");
}
Source Code Explanations Contd...
display2.setText(String.valueOf(inb)+"^2"); //for square operation
/*display2.setText(String.valueOf(inb)+"^3"); for cube operation
*display2.setText("√"+String.valueOf(inb)); for square root operation
*display2.setText("3√"+String.valueOf(inb)); for cube root operation
*display2.setText("1/"+String.valueOf(inb)); for 1 divided by X operation
*/
out=0; op=0; }”
“private void piActionPerformed(java.awt.event.ActionEvent evt) {
display1.setText(String.valueOf(Math.PI)); // displays the value of PI
} “
Source Code Explanations Contd...
ActionPerformed on Geometic Operations:
“private void sinActionPerformed(java.awt.event.ActionEvent evt) {
inb=Double.parseDouble(String.valueOf(display1.getText()));
if(!sh){
if(!dgrrad){
display2.setText("sin("+String.valueOf(inb)+")"); // for sine operation
/*display2.setText("cos("+String.valueOf(inb)+")"); for sine operation
*display2.setText("tan("+String.valueOf(inb)+")"); for sine operation*/
inb=inb*0.0174532925; }
out=Math.sin(inb); // for sine operation
/* out=Math.cos(inb); for cosine operation
* out=Math.tan(inb); for tan operation*/ }
Source Code Explanations Contd...
else{
display2.setText("sinh("+String.valueOf(inb)+")"); // for sinh operation
/*display2.setText("cosh("+String.valueOf(inb)+")"); for cosinh operation
*display2.setText("tanh("+String.valueOf(inb)+")"); for tanh operation */
out=Math.sinh(inb); // for sinh operation
/*out=Math.cosh(inb); for cosh operation
*out=Math.tanh(inb); for tanh operation*/
}
display1.setText(String.valueOf(out)); out=0;
op=0; }”
Source Code Explanations Contd...
ActionPerformed Degree & Radian :
“ private void degreesActionPerformed(java.awt.event.ActionEvent evt) {
dgrrad=false; } //making boolean value false (default)
private void radiansActionPerformed(java.awt.event.ActionEvent evt) {
dgrrad=true;} ” //making boolean value true
Source Code Explanations Contd...
ActionPerformed on Arithmetic Operations:
“private void ARITHMETIC(+,-,*,/)ActionPerformed(java.awt.event.ActionEvent evt) {
if(op==0){
ina=Double.parseDouble(String.valueOf(display1.getText()));
}else{ inb=Double.parseDouble(String.valueOf(display1.getText()));
}if(op==1){
ina=ina+inb;
}if(op==2){
ina=ina-inb;
}if(op==3){
ina=ina*inb;
}
Source Code Explanations Contd...
if(op==4){
ina=ina/inb;
} if(op==5){
ina=ina*inb/100;
}
display1.setText("0");
display2.setText(String.valueOf(ina)+"+"); //for addition
op=1; //for addition
/*display2.setText(String.valueOf(ina)+"-"); for subtraction
*op=2; for subtraction
*display2.setText(String.valueOf(ina)+"*"); for multiplication
*op=3; for multiplication
*display2.setText(String.valueOf(ina)+"/"); for division
*op=4; for division
Source Code Explanations Contd...
*display2.setText(String.valueOf(ina)+"%("); for 1 by X
*op=5; for 1 by X*/
decdisp=false; //setting boolean value false
zerodisp=false;}” //setting boolean value false
Source Code Explanations Contd...
ActionPerformed on Equal Operation:
“ private void equalsActionPerformed(java.awt.event.ActionEvent evt) {
inb=Double.parseDouble(String.valueOf(display1.getText()));
if(op==0){
out=inb; // if op=0 then show display1
display2.setText(String.valueOf(inb));
} if(op==1){
out=ina+inb; // if op=1 then perform addition
display2.setText(display2.getText()+String.valueOf(inb));
} if(op==2){
out=ina-inb; // if op=2 then perform subtraction
display2.setText(display2.getText()+String.valueOf(inb));
} if(op==3){
out=ina*inb; // if op=3 then perform
multiplication
Source Code Explanations Contd...
display2.setText(display2.getText()+String.valueOf(inb));
} if(op==4){
out=ina/inb; // if op=4 then perform division
display2.setText(display2.getText()+String.valueOf(inb));
} if(op==5){
out=ina*inb/100; // if op=5 then perform percentage
display2.setText(display2.getText()+String.valueOf(inb)+")");
} if(out > -100000000 && out < 100000000){
display1.setText(String.valueOf(out));
} else {
display1.setText("Error");
}
Source Code Explanations Contd...
ina=0; //initialing variable ina to 0
inb=0; //initialing variable inb to 0
out=0; //initialing variable out to 0
decdisp=false; //initialing variable decdisp to false
zerodisp=false; //initialing variable zerodisp to false
}”
Source Code Explanations Contd...
Executing main Function:
“public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
/*The invokeLater() method takes a Runnable object as its parameter. It sends that object to the event-dispatching thread, which
executes the run() method. This is why it's always safe for the run() method to execute Swing code.*/
public void run() {
new Calculate().setVisible(true); // reveals a Component by marking it as visible
}
});
}”
THANK YOU ALL...

More Related Content

What's hot (20)

JavaScript - Chapter 3 - Introduction
 JavaScript - Chapter 3 - Introduction JavaScript - Chapter 3 - Introduction
JavaScript - Chapter 3 - Introduction
 
Java - Exception Handling Concepts
Java - Exception Handling ConceptsJava - Exception Handling Concepts
Java - Exception Handling Concepts
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIO
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
ECMA Script
ECMA ScriptECMA Script
ECMA Script
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Angular Observables & RxJS Introduction
Angular Observables & RxJS IntroductionAngular Observables & RxJS Introduction
Angular Observables & RxJS Introduction
 
JAVA 8
JAVA 8JAVA 8
JAVA 8
 
Interface in java
Interface in javaInterface in java
Interface in java
 
PYTHON - TKINTER - GUI - PART 1.ppt
PYTHON - TKINTER - GUI - PART 1.pptPYTHON - TKINTER - GUI - PART 1.ppt
PYTHON - TKINTER - GUI - PART 1.ppt
 
Swing
SwingSwing
Swing
 
Java practical
Java practicalJava practical
Java practical
 
Type Classes in Scala and Haskell
Type Classes in Scala and HaskellType Classes in Scala and Haskell
Type Classes in Scala and Haskell
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
guess the number project.docx
guess the number  project.docxguess the number  project.docx
guess the number project.docx
 
Tail Recursion in data structure
Tail Recursion in data structureTail Recursion in data structure
Tail Recursion in data structure
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Introducing Async/Await
Introducing Async/AwaitIntroducing Async/Await
Introducing Async/Await
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.
 

Viewers also liked

Scientific calculator in c
Scientific calculator in cScientific calculator in c
Scientific calculator in cUpendra Sengar
 
scientific calculator using c
scientific calculator using cscientific calculator using c
scientific calculator using cAnuj Kumar
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c languageAMIT KUMAR
 
Slide Makeover #80: Shifting breakdown of segments totalling 100%
Slide Makeover #80: Shifting breakdown of segments totalling 100%Slide Makeover #80: Shifting breakdown of segments totalling 100%
Slide Makeover #80: Shifting breakdown of segments totalling 100%Dave Paradi
 

Viewers also liked (6)

Scientific calculator in c
Scientific calculator in cScientific calculator in c
Scientific calculator in c
 
scientific calculator using c
scientific calculator using cscientific calculator using c
scientific calculator using c
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
 
Java calculator
Java calculatorJava calculator
Java calculator
 
Slide Makeover #80: Shifting breakdown of segments totalling 100%
Slide Makeover #80: Shifting breakdown of segments totalling 100%Slide Makeover #80: Shifting breakdown of segments totalling 100%
Slide Makeover #80: Shifting breakdown of segments totalling 100%
 
Project explation ppt
Project explation pptProject explation ppt
Project explation ppt
 

Similar to Java final project of scientific calcultor

Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageDroidConTLV
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word documentnidhileena
 
Node.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizationsNode.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizationsDawid Rusnak
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorJie-Wei Wu
 
Test-driven JavaScript Development - OPITZ CONSULTING - Tobias Bosch - Stefa...
Test-driven JavaScript Development - OPITZ CONSULTING -  Tobias Bosch - Stefa...Test-driven JavaScript Development - OPITZ CONSULTING -  Tobias Bosch - Stefa...
Test-driven JavaScript Development - OPITZ CONSULTING - Tobias Bosch - Stefa...OPITZ CONSULTING Deutschland
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascriptkvangork
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScriptkvangork
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchainedEduard Tomàs
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSAdam L Barrett
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
JavaScript (without DOM)
JavaScript (without DOM)JavaScript (without DOM)
JavaScript (without DOM)Piyush Katariya
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbroncymbron
 
Assignment #2.classpathAssignment #2.project Assig.docx
Assignment #2.classpathAssignment #2.project  Assig.docxAssignment #2.classpathAssignment #2.project  Assig.docx
Assignment #2.classpathAssignment #2.project Assig.docxfredharris32
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesSiarhei Barysiuk
 

Similar to Java final project of scientific calcultor (20)

Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritage
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
Node.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizationsNode.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizations
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Test-driven JavaScript Development - OPITZ CONSULTING - Tobias Bosch - Stefa...
Test-driven JavaScript Development - OPITZ CONSULTING -  Tobias Bosch - Stefa...Test-driven JavaScript Development - OPITZ CONSULTING -  Tobias Bosch - Stefa...
Test-driven JavaScript Development - OPITZ CONSULTING - Tobias Bosch - Stefa...
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
 
Scala coated JVM
Scala coated JVMScala coated JVM
Scala coated JVM
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
JavaScript (without DOM)
JavaScript (without DOM)JavaScript (without DOM)
JavaScript (without DOM)
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
Assignment #2.classpathAssignment #2.project Assig.docx
Assignment #2.classpathAssignment #2.project  Assig.docxAssignment #2.classpathAssignment #2.project  Assig.docx
Assignment #2.classpathAssignment #2.project Assig.docx
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 

Recently uploaded

Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 

Recently uploaded (20)

Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 

Java final project of scientific calcultor

  • 1. OBJECT ORIENTED PROGRAMMING (ii) Java Final Project Creating Scientific Calculator
  • 2. Team Members Name Exam Roll Class Roll 1. Md. Eunus Ali Rupom 140135 24 2. Md. Sujan Bhuiyan 140149 38 3. Md. Sejan Ahmed 140150 39
  • 3. Features Arithmetic Functions Geometric Functions Memory Functions 1. Addition 1. Sine 1. Memory Save 2. Subtraction 2. Cosine 2. Memory Read 3. Multiplication 3. Tangent 3. Memory Clear 4. Division 4. Degree 5. Percentage 5. Radian
  • 4.
  • 5. GUI Programming Step 1 : Creating a JFrame using NetBeans IDE Step 2 : Forming a design using drag & drop Step 3 : Make sure all buttons are working Step 4 : Write down the Action performed of all the components Step 5 : Removing Bug Step 6 : Run & Execute the programe.
  • 6. Source Code Explanations Entering variables into the Calculator Application “ import java.math.*; //import Statements public class Calculate extends javax.swing.JFrame { //class Header private boolean zerodisp,decdisp,dgrrad,sh; //private Variables Declared private byte op; //private Variables Declared private double ina,inb,out; “ //private Variables Declared
  • 7. Source Code Explanations Contd... “Calculate” Constructor was called with a function “initComponents()” to implement it later “ public Calculate() { //constructor initComponents(); } “
  • 8. Source Code Explanations Contd... ActionPerformed pattern of 0-9 digits/buttons & decpoint button private void DIGITActionPerformed(java.awt.event.ActionEvent evt) { “ if(!zerodisp && !decdisp){ display1.setText(null); } display1.setText(display1.getText()+"DIGIT"); zerodisp = true; //not for zero } ” here , function “setText(String Value)” - Sets the text displayed by the text field & “getText(String Value)” - Obtains the text displayed by the text field.
  • 9. Source Code Explanations Contd... ActionPerformed on negate: “private void negateActionPerformed(java.awt.event.ActionEvent evt) { inb = Double.parseDouble(String.valueOf(display1.getText())); out=inb * -1; if(out > -100000000 && out < 100000000){ display1.setText(String.valueOf(out)); }else { display1.setText("Error");}out=0; }” Here, Function “String.valueOf()” - Returns the string representation of the input argument & “Double.parseDouble()”- Returns a primitive double containing the value of the string:
  • 10. Source Code Explanations Contd... ActionPerformed on Memory functions: “private void memoryreadActionPerformed(java.awt.event.ActionEvent evt) { display1.setText(String.valueOf(memorydisplay.getText())); //took value from memory display & set that at display1 } private void memoryclearActionPerformed(java.awt.event.ActionEvent evt) { memorydisplay.setText("0"); //clears memory from memory display & set value as 0 } private void memorysaveActionPerformed(java.awt.event.ActionEvent evt) { memorydisplay.setText(String.valueOf(display1.getText()));}” //took value from display1 & set that at memory display
  • 11. Source Code Explanations Contd... ActionPerformed on Arithmetic Operations & PI: “ private void ARITHMETICActionPerformed(java.awt.event.ActionEvent evt) { inb=Double.parseDouble(String.valueOf(display1.getText())); out=inb*inb; //for square operation /* out = inb*inb*inb for cube operation * out = Math.sqrt(inb) for square root operation * out=Math.cbrt(inb) for cube root operation * out=1/inb for 1 dividev by X */ if(out > -100000000 && out < 100000000){ display1.setText(String.valueOf(out)); } else { display1.setText("Error"); }
  • 12. Source Code Explanations Contd... display2.setText(String.valueOf(inb)+"^2"); //for square operation /*display2.setText(String.valueOf(inb)+"^3"); for cube operation *display2.setText("√"+String.valueOf(inb)); for square root operation *display2.setText("3√"+String.valueOf(inb)); for cube root operation *display2.setText("1/"+String.valueOf(inb)); for 1 divided by X operation */ out=0; op=0; }” “private void piActionPerformed(java.awt.event.ActionEvent evt) { display1.setText(String.valueOf(Math.PI)); // displays the value of PI } “
  • 13. Source Code Explanations Contd... ActionPerformed on Geometic Operations: “private void sinActionPerformed(java.awt.event.ActionEvent evt) { inb=Double.parseDouble(String.valueOf(display1.getText())); if(!sh){ if(!dgrrad){ display2.setText("sin("+String.valueOf(inb)+")"); // for sine operation /*display2.setText("cos("+String.valueOf(inb)+")"); for sine operation *display2.setText("tan("+String.valueOf(inb)+")"); for sine operation*/ inb=inb*0.0174532925; } out=Math.sin(inb); // for sine operation /* out=Math.cos(inb); for cosine operation * out=Math.tan(inb); for tan operation*/ }
  • 14. Source Code Explanations Contd... else{ display2.setText("sinh("+String.valueOf(inb)+")"); // for sinh operation /*display2.setText("cosh("+String.valueOf(inb)+")"); for cosinh operation *display2.setText("tanh("+String.valueOf(inb)+")"); for tanh operation */ out=Math.sinh(inb); // for sinh operation /*out=Math.cosh(inb); for cosh operation *out=Math.tanh(inb); for tanh operation*/ } display1.setText(String.valueOf(out)); out=0; op=0; }”
  • 15. Source Code Explanations Contd... ActionPerformed Degree & Radian : “ private void degreesActionPerformed(java.awt.event.ActionEvent evt) { dgrrad=false; } //making boolean value false (default) private void radiansActionPerformed(java.awt.event.ActionEvent evt) { dgrrad=true;} ” //making boolean value true
  • 16. Source Code Explanations Contd... ActionPerformed on Arithmetic Operations: “private void ARITHMETIC(+,-,*,/)ActionPerformed(java.awt.event.ActionEvent evt) { if(op==0){ ina=Double.parseDouble(String.valueOf(display1.getText())); }else{ inb=Double.parseDouble(String.valueOf(display1.getText())); }if(op==1){ ina=ina+inb; }if(op==2){ ina=ina-inb; }if(op==3){ ina=ina*inb; }
  • 17. Source Code Explanations Contd... if(op==4){ ina=ina/inb; } if(op==5){ ina=ina*inb/100; } display1.setText("0"); display2.setText(String.valueOf(ina)+"+"); //for addition op=1; //for addition /*display2.setText(String.valueOf(ina)+"-"); for subtraction *op=2; for subtraction *display2.setText(String.valueOf(ina)+"*"); for multiplication *op=3; for multiplication *display2.setText(String.valueOf(ina)+"/"); for division *op=4; for division
  • 18. Source Code Explanations Contd... *display2.setText(String.valueOf(ina)+"%("); for 1 by X *op=5; for 1 by X*/ decdisp=false; //setting boolean value false zerodisp=false;}” //setting boolean value false
  • 19. Source Code Explanations Contd... ActionPerformed on Equal Operation: “ private void equalsActionPerformed(java.awt.event.ActionEvent evt) { inb=Double.parseDouble(String.valueOf(display1.getText())); if(op==0){ out=inb; // if op=0 then show display1 display2.setText(String.valueOf(inb)); } if(op==1){ out=ina+inb; // if op=1 then perform addition display2.setText(display2.getText()+String.valueOf(inb)); } if(op==2){ out=ina-inb; // if op=2 then perform subtraction display2.setText(display2.getText()+String.valueOf(inb)); } if(op==3){ out=ina*inb; // if op=3 then perform multiplication
  • 20. Source Code Explanations Contd... display2.setText(display2.getText()+String.valueOf(inb)); } if(op==4){ out=ina/inb; // if op=4 then perform division display2.setText(display2.getText()+String.valueOf(inb)); } if(op==5){ out=ina*inb/100; // if op=5 then perform percentage display2.setText(display2.getText()+String.valueOf(inb)+")"); } if(out > -100000000 && out < 100000000){ display1.setText(String.valueOf(out)); } else { display1.setText("Error"); }
  • 21. Source Code Explanations Contd... ina=0; //initialing variable ina to 0 inb=0; //initialing variable inb to 0 out=0; //initialing variable out to 0 decdisp=false; //initialing variable decdisp to false zerodisp=false; //initialing variable zerodisp to false }”
  • 22. Source Code Explanations Contd... Executing main Function: “public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { /*The invokeLater() method takes a Runnable object as its parameter. It sends that object to the event-dispatching thread, which executes the run() method. This is why it's always safe for the run() method to execute Swing code.*/ public void run() { new Calculate().setVisible(true); // reveals a Component by marking it as visible } }); }”