Challenge

Project

Report OOPs concepts:

Object-Oriented Programming System is a programming concept that works on the principles of classes, objects ,methods,Packages, abstraction, encapsulation, inheritance, and polymorphism.

  • Classes: class is a blueprint from which objects are created. It represents the set of properties or methods that are common to all objects of one type.

Modifiers: A class can be public or has default access.

class keyword: class keyword is used to create a class.

Class name: The name should begin with an initial letter Superclass also called parent class and subclass also called childclass.

Here, in the program classes are declared Declaration of class calculator.Example -public class Calculator here Declaration of class calculator is done.

Examples of classes created in the program- public class SquareRoot ,public class TrignometricFunction,public class Logarithm,public class Binarytodecimalnumber are the classes declared.

  • Objects : Object is created from a class and represents the real life entities.

To create an object specify the class name followed by the object name and use the keyword new.

State: It is represented by attributes of an object. Behavior: It is represented by methods of an object.

for example; SquareRoot sqrt= new SquareRoot();

Here object is created using new keyword of that class and sqrt.getNum(); this calls the object of that method. Identity: It gives a unique name to an objectt.

Logarithm logarithm= new Logarithm();
logarithm.Logarithm();

  • Methods: Methods are declared within a classand that they are used to perform certain actions.Method includes modifier,Return type, Method Name,Method body. static method, which means that it can be accessed without creating an object of the class and public which can only be accessed by objects.

Examples: public void getNum() here method is created with no return value void.

public void TrignometricFunction()

public void Logarithm()

public void InverseTrignometry1()

public void Sip() These are the methods used in the program.

  • Packages: A package in Java is used to group related classes.There are two types:-

Built-in Packages (packages from Java) and User-defined Packages (create own packages)

--import java.util.Scanner.

The Scanner class which is used to get input from the user.

In the example above java.util is a package, while Scanner is a class of the java.util package.

  • Encapsulation:- Encapsulation is used to hide the date from the users.

For Encapsulation we must declare class attributes as private.

To Provide public get and set methods to access the value of a private variable.

The get method returns the value and the set method sets the value.

  • Inheritance: In Ineritance one class inherits from other class.

It is possible to inherit methods and attributes from one class to antoher clalss.

Superclass also called as parent class which inherits from other class.

Subclass also called as child class which inherits from a parent class.

To inherit a class we use extends keyword. so in subclass or child class inherits properties of parent class.

  • Polymorphism :-Polymorphism means having many forms and it occurs when we have many classes that are related to each other by inheritance.

Polymorphism allows us to perform a single action in different ways.

There are two types of polymorphism

Compile time Polymorphism and

Runtime Polymorphism.

Compile time polymorphism is achieved by method overloading. Here in method overloading the methods created should come in one class or same class.

Arguments should be different.

In Runtime Polymorphism it is achieved by method overriding.Here in method overriding the methods created should be same and have different class.

Arguments should be same.

  • Abstraction: Data abstraction is the process of hiding certain details and showing only essential information to the user.

Abstraction can be achieved with either abstract classes or interfaces.

The abstract keyword is a non-access modifier used for classes and methods:

Abstract class: Is a restricted class that cannot be used to create objects .

Abstract method: Can only be used in an abstract class and it does not have a body. The body is provided by the subclass.

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.