Challenge

Project

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 .

sciCalci cal = new sciCalci(); 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 whale is a part of the classification of marine animals, which is part of class mammal, which is under that class of animal. 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 SCINETIFIC CALCULATOR :

At first we are creating diffrent class for calculation purpose , such as we have made sciCalci,Converter, SIP and our main method is in Screen class . In class sciCalci we have created diffrent behaviours/parts of calculation i.e.. addition , subtraction , multiplication,division .etc.

We have also used interface serilization by iimplimenting in class scicalci 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 diffrent 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 .

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..

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.