Project
Report:
Scientific calculator is a type of electronic device usually use to calculate scientific mathematical and engineering problems. They have completely change the way of calculations done in science and maths and made the equation solving much easier.
Details about the project
In this project we have designed a scientific calculator which can be used to solve sum of the calculations as similar as a scientific calculator this calculator is designed by using some of the concepts of OOP.
OOP.
Oop also called as object oriented programming is a method used to design a program using two things called as classes and methods examples of op language C and Java.
In OOP, objects are well defined which uses some of the following concepts.
1 Object
2 Class
3 Inheritance
4 Polymorphism
5 Abstraction
6 Encapsulation.
Scientific calculator using OOPS.
In the attach zip file the code for the scientific calculator along with digit converter and SIP calculator is attached.
Objects are called as the instance of an object. Objects are created in class in Java programming language.
Object different objects stores different values for different segments of codes.
Here we can use different objects for addition subtraction multiplication division and to store code of these operations individually .
Classes.
Class in a java file is a file which contains Java bite code that can be executed on any virtual Machine called as Java virtual Machine.
Class in Java is usually produced by Java compiler. In simple terms collection of objects is called as a class
Classes are also called as logical quantities and do not consume any space in memory.
Class contains methods and constructors.
Abstraction.
Abstraction process involves displaying only the information needed or display the information and hiding unnecessary information, for example a book has an abstract page where the entire theme of the book is displayed.
The main purse purse of abstraction is data hiding, which shrinks the content and shows most useful data
Abstraction helps yo reduce complexities.
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 the property of Java in which one object can Inherit the properties from other object.
The main advantage of inheritance is we can create new classes based on pre-built, like inherit one property from parent class.
Inheritance saves a lot of time , as we reuse the methods defined already.
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 can take various forms, or it can refer to a process that executes a single activity in several ways. It happens when there are several classes that are connected to each other through inheritance. Polymorphism is classified into two types: compile-time polymorphism and runtime polymorphism. When we override a static method in Java, this is an example of compile time polymorphism. A dynamic method is another name for run time polymorphism. A dispatch method is one in which a call to an overridden method is resolved at run time rather than compile time.
Encapsulation
Encapsulation is a notion in OOPs; it is the process that ties together data and code into a single unit, keeping both protected from outside intervention and abuse. During this procedure, the data is concealed from other classes and can only be accessible through the methods of the current class. As a result, it is also known as data concealing. Encapsulation functions as a protective covering that prohibits others from accessing the code and data. These are managed using a well-defined interface.
Encapsulation is performed by designating variables private and giving public setter and getter methods for changing and viewing variable values.
How does this calculator work??
First, we create different classes for calculating purposes, such as scicalculate, DigitConversion, SIP, and our primary method is in CalciScreen. In class scicalculate, we constructed several calculating behaviors/parts like as addition, subtraction, multiplication, division, and so on.
We've also utilised interface serilaization, which we implemented in class scicalculate, to store values that aren't visible without Deserilisation.
Then, in the main class, we asked whatever sort of computation they would perform; for each choice, there is a separate loop. Only when we pick the OFF option will this loop be terminated.
We have a separate History option, which is saved in a separate file called CalculationsHistory.txt. We may verify History by just refreshing.
There are several try-catch blocks and throws in Screen to avoid code mistakes. The main error in the entire code is InputMismatchException, which ensures that the user only enters numbers and not any other input such as character, string, symbols, etc. And if anything other than Double is input, it displays the message only numbers are allowed.
This Calculator can convert decimal numbers to binary numbers by utilising the object d2b from the class DigitConversion.
If we want to recall any number that we have calculated, we can use the recall option. There is also a stor option if we want to save the computed value or any new number.
Advantage: It stores the history in file format, ehich can be viewed later.
Disavantage: it doesn’t perform complex functions.
.
- Pranay Ukundehello prtham can you help me for complete my project