Challenge

Project

About Scientific Calculator

A Scientific calculator is a type of electronic calculator, usually but not always handheld, designed to calculate problems in science, engineering, and mathematics. They have completely replaced slide rules in traditional applications, and are widely used in both education and professional settings.

About the Project

This Project is of a Scientific Calculator which can be used for some of the calculations as similar to the scientific calculator.This is made by using and following the concepts of Object Oriented Programming also called as OOPs.

OOPS
Object Orriented Programming is a method Used for designing a program using classes and object. OOPs is also called the core of java . OOPs organize a program around object and well - defined interface. This Implies Software development and maintainence by using some of concepts : 1. Object 2. Class 3. Abstarction 4. Inheritance 5. Polymorphism 6. Encapculation

SCIENTIFIC CALCULATOR USING OOPS :
In below zip file the whole code for scientific Calculator ,digit convertor , and SIP calculator is written.
In this report we are going to see hoe this calculator works using OOPS concept .
OBJECT : Objects are always callde as instance of an object .Object are created from class in java or any other languages. Objects are those that have state and behaviour. For Example : in calculator I used diffrent objects of class sciCalci i.e.. add,subtraction , multiplication, division.......etc .
scicalculate cal = new scicalculate();

In above line of Code cal is an object of Class sciCalci and this object "cal" have following behaviour ,, cal.add(a,b) cal.subtraction(a,b) , cal.mult(a,b)... etc .


CLASSES :

Classes are like an object constructor for creation objects . Collection of object is said to be class . Classes are said to be logical quantities . Classes don't consume any space in memory . Classes have members which can be field , methods, and constructor. For Example : Below is Class named SIP having fields , methods and costructor
class SIP { public Sip{ } double p;
double ir;
double t; double add(p , t){ ir = p+t; return ir; }
}

ABSTRACTION : Abstraction is a process which dicplays only the information needed and hides the unnecessary information . We can ay that the main purpose of abstraction is data hiding . Abstraction means selecting data from a large number of data to show the info needed , which helps in reducing programming complexcity and efforts . For Example :

//abstract parent class

Abstract class animal {

//abstract method

public abstract void sound ( ) ;

}

Public class lion extends animal {

Public void sound ( ) {

System.out.println (“ roar “ );

}

public Static void main ( String args [ ] ) {

animal obj = new lion ( );

obj. sound ();

}

}

INHERITANCE : Inheritance is a method in which one object acquires/inherits another object’s properties, and inheritance also supports hierarchical classification. The idea behind this is that we can create new classes built on existing classes, i.e., when you inherit from an existing class, we can reuse methods and fields of the parent class. Inheritance represents the parent-child relationship.
For Example, a Eagle is a part of the classification of Carnivorous bird , which is part of class aves, which is under that class of Birds. We use hierarchical classification, i.e., top-down classification.

Class a {

}

Class b extends class a {

}

POLYMORPHISM : Polymorphism refers to many forms, or it is a process that performs a single action in different ways. It occurs when we have many classes related to each other by inheritance. Polymorphism is of two different types, i.e., compile-time polymorphism and runtime polymorphism. One of the examples in Compile time polymorphism is that when we overload a static method in java. Run time polymorphism is also called a dynamic method dispatch is a method in which a call to an overridden method is resolved at run time rather than compile time.

ENCAPSULATION : Encapsulation is one of the concepts in OOPs concepts; it is the process that binds together the data and code into a single unit and keeps both from being safe from outside interference and misuse. In this process, the data is hidden from other classes and can be accessed only through the current class’s methods. Hence, it is also known as data hiding. Encapsulation acts as a protective wrapper that prevents the code and data from being accessed by outsiders. These are controlled through a well-defined interface.


Encapsulation is achieved by declaring the variables as private and providing public setter and getter methods to modify and view the variable values.

WORKING OF SCIENTIFIC CALCULATOR :
At first we are creating diffrent class for calculation purpose , such as we have made scicalculate,DigitConversion, SIP and our main method is in CalciScreen class . In class scicalculate we have created diffrent behaviours/parts of calculation i.e.. addition , subtraction , multiplication,division .etc.


We have also used interface serilaization by iimplimenting in class scicalculate to store value which can't be seen without Deserilisation .
Then in main class we first asked for which type of calculation will they do, for every option their is different loop . These loop will be closed only when we select OFF option .


We have a seperate option for History which is been stored in seperate file named CalculationsHistory.txt . Whenever we want to check History just refresh the project.


There are many try-catch block and throws in Screen to avoid errors through code, Main error in the whole code is InputMismatchException which make sure that user enter numbers only and not any other input like character, string, symbols , etc.. And if anything is entered other than Double then its shows output ONLY NUMBERS ALLOWED!!!!!!.

If we want to recall any number that we have calculated we can recall using recall option and also stor option is there if we want to store calculated value or any new number then we can do using this stor option.

This Calculator can can convert the decimal to binary number coversion by using object d2b made from class DigitConversion.

Advantage and Disadvantage of This Project

DISADVANTAGE:-

It cannot use many fuction like integration , differentiation and cannot solve equations .

ADVANTAGE:-

It can show History in the file format and can be saved for future use .

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.