Object Oriented Programming CE-102T/CE-102L

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

Object Oriented

Programming
CE-102T/CE-102L
-Section: B
-SUBMITTED BY:
o Abrar Manzoor 2020F-BCE-055
o Osaid Mirza 2020F-BCE-057
o Aisha Irshaad 2020F-BCE-80
o Arisha Khan 2020F-BCE-82
- Department: Computer Engineering 
Contents

Introduction to
Mark Sheet
Acknowledgment JAVA
Generator System
Programming 
Click to add text

Object Oriented
Project Overview  Commands
programming 

Program Coding  Output Conclusion


ACKNOWLEDGMENT

• Our Group has worked on a project which Marksheet


generating System by using NETbeans oop Java
• All the Credits to our honourable teacher Sir Habib
Shaukat and Miss Aneeta to help us through out , we
wouldn’t have been able to do it without their help.
• We do want to give the credits to our faculty of (oop)
for their help in this difficult project. 
Marks Generating System
Introduction to Java:

• JAVA was developed by Sun Microsystems Inc in


1991, later acquired by Oracle Corporation. It was
developed by James Gosling and Patrick Naughton. 
• It is a simple programming language.
•  The target of Java is to write a program once and then
run this program on multiple operating systems. 
•  The first publicly available version of Java (Java 1.0)
was released in 1995.
• Java is defined by a specification and consists of a
programming language.
• The Java runtime allows software developers to write
program code in other languages than the Java
programming language which still runs on the Java.
In  our group project; we created a
Marksheet Generator System at
NetBeans by help of Java computer
language. 
• Firstly, you have to open the file in
Project NetBeans and open the marksheet
overview folder 
• Then open the main Java folder and
then by pressing Shit+F6
button   and the project will run. 
• Java is Object-oriented, Architecture neutral, Portable, Distributed,
Details Robust, High performance,  Multithreaded, Dynamic, Simple.
 Your computer or laptop must have this things to run Java or this project. 

SYSTEM HARDWARE      
Processor : Intel Core i3   
Hard disk : 20GB or more than 20GB   
RAM : 1GB    
Printer : to print the required documents   
Compact Drive   
  
 SYSTEM SOFTWARE   
Operating System :Windows 7   
Turbo C :For execution of program   
Ms Word :For Presentation output 
OBJECT ORIENTED PROGRAMMING (OOP):

• Object-oriented programming (OOP) is a


fundamental programming paradigm used
by nearly every developer at some point
in their career. OOP is the most popular
programming paradigm and is taught as
the standard way to code for most of a
programmers educational career.
• The four basics of OOP are as follow.
    -Abstraction
    -Encapsulation
    -inheritance
    -polymorphism. 
• VARIABLES:
• VARIABLES are containers for storing data values. In
Java, there are different types of variables, for
example: String - stores text, such as "Hello". String
values are surrounded by double quotes. int -
stores integers (whole numbers), without decimals,
such as 123 or -123.
Commands
• TYPE CASTING:
• Type casting is when you assign a value of one
primitive data type to another type. In Java, there
are two types of casting: Widening Casting
(automatically) - converting a smaller type to a
larger type size.
• IF STATEMENT:
• The Java if statement is the most simple decision-making statement. It is used to decide whether a certain
statement or block of statements will be executed or not i.e if a certain condition is true then a block
of stat.ement is executed otherwise not.

• IF ELSE:
• Java has the following conditional statements: Use if to specify a block of code to be executed, if a specified
condition is true. Use else to specify a block of code to be executed, if the same condition is false. Use else if
to specify a new condition to test, if the first condition is false.

• SWITCH:
• A switch statement allows a variable to be tested for equality against a list of values. Each value is called a
case, and the variable being switched on is checked for each case.
• LOOP:
• The Java for loop is a control flow statement that iterates a part of the programs multiple times. The Java while loop is a control flow statement that
executes a part of the programs repeatedly on the basis of given boolean condition.

• WHILE LOOP:
• Java while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be
thought of as a repeating if statement. The various parts of the While loop are: Test Expression: In this expression we have to test the condition.

• NESTED LOOP:
• Nested loop means a loop statement inside another loop statement.
• ARRAY:

• Java array is an object which contains elements of a similar data type. In Java, array is an object of a dynamically generated class. Java array inherits the Object class and implements the Serializable as well as Cloneable
interfaces. We can store primitive values or objects in an array in Java.

• There are two types of array.

• Single Dimensional Array.

• Multidimensional Array.

• CONSTRUCTOR

• A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created.

• METHOD OVERLOADING 

• In other words, we can say that Method overloading is a concept of Java in which we can create multiple methods of the same name in the same class, and all methods work in different ways. When more than one
method of the same name is created in a Class, this type of method is called Overloaded Method
• POLYMORPHISM IN JAVA 

• Polymorphism in Java is a concept by which we can perform a single action in different ways.
So, polymorphism means many forms. There are two types of polymorphism in Java:
compile-time polymorphism and runtime polymorphism. We can perform polymorphism in
java by method overloading and method overriding

• INHERITANCE IN JAVA 

• In Java, it is possible to inherit attributes and methods from one class to another. We group
the "inheritance concept" into two categories: subclass (child) - the class that inherits from
another class. superclass (parent) - the class being inherited from.

• CONSTRUCTOR OVERLOADING 

• Java Constructor overloading is a technique in which a class can have any number of
constructors that differ in parameter list. The compiler differentiates these constructors by
taking into account the number of parameters in the list and their type.
MAIN

/*
 * To change this license header, choose License Headers in
Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

Coding package MarksheetGenerator;


/**
 *
 * @author Abrar Manzoor
 */
public class Main {
   public static void main(String[] args) {
        MarkSheetGenerator obj=new MarkSheetGenerator();
        obj.Marksheet();
  }
}
 MARKSHEET GENERATOR
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package MarksheetGenerator;

/**
 *
 * @author Abrar Manzoor
 */
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
public class MarkSheetGenerator extends StudentInfo {
    Scanner sc=new Scanner(System.in);
  int total(int mark[]){
        int sum=0;
        for (int i = 0; i < mark.length; i++) {
            sum=sum+mark[i];
      }
        return sum;
  }
    
    float Percentage(int total,int totalmarks){
    
        return (total*100) / totalmarks;
  }
@Override
    public void Marksheet(){
        super.Marksheet();
        System.out.println("Enter total number of Courses: ");
        int course=Integer.parseInt(sc.nextLine());
        String subj[];
        subj=new String[course];
        for (int i = 0; i < subj.length; i++) {
            int s=i+1;
            System.out.println("Enter Course name "+s);
            subj[i]=sc.nextLine();
    }
     int marks[]=new int[subj.length];
        for (int i = 0 ; i < subj.length; i++) {
            System.out.println("Enter the marks of "+subj[i]+":");
            marks[i]=sc.nextInt();
}
        int totalmarks=subj.length*100;
        int total=total(marks);
        System.out.println("Total Marks:"+total);
        System.out.println("Percentage:"+Percentage(total,totalmarks));
    
        System.out.println("DO you want to print Mark Sheet(Y/N):");
        char opt=sc.next().charAt(0);
        if(opt=='Y' || opt=='y'){
         try{
             String filename=getRoll()+".text";
             PrintWriter out=new PrintWriter(filename);
out.println("\t\t\t\tMarksheet\t\t\t");
             out.println("Roll Numer: "+getRoll());
             out.println("Student Name: "+getFull_name());
     out.println("Father Name: "+getFather_Name());
             out.println("Batch: "+getBatch());
        
          out.println("Department: "+getBatch());
             out.println("\n\n");
             out.println("Courses\t\t\tMarks");
             for (int i = 0; i < subj.length; i++) {
                 out.println(subj[i]+"\t\t\t"+marks[i]);
             }
             out.println("\n\nTotal Marks: "+totalmarks);
             out.println("Marks Obtained: "+total);
             float perc=Percentage(total,totalmarks);
             out.println("Percentage: "+perc+"%");
                         out.close();
         }
catch(Exception e){
             System.out.println(e);
         }     
  }
        else{
      }}
STUDENT INFO:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package MarksheetGenerator;
/**
 *
 * @author Abrar Manzoor
 */
import java.util.Scanner;
public class StudentInfo {
    String roll;
    String full_name;
    String Father_Name;
    int batch;
     String dept;
public String getFull_name() {
        return full_name;
  }
    public void setFull_name(String full_name) {
        this.full_name = full_name;
  }

    public String getFather_Name() {


        return Father_Name;
  }
    public void setFather_Name(String Father_Name) {
        this.Father_Name = Father_Name;
  }

    public int getBatch() {


        return batch;
  }
public void setBatch(int batch) {
        this.batch = batch;
  }
    public String getDept() {
        return dept;
  }
    public void setDept(String dept) {
        this.dept = dept;
  }
    public String getRoll() {
        return roll;
  }
    public void setRoll(String roll) {
        this.roll = roll;
  }
    public Scanner getSc() {
        return sc;
  }
    
    Scanner sc=new Scanner(System.in);
    public void Marksheet(){
System.out.println("Enter Roll Number: ");
        String roll=sc.nextLine();
        setRoll(roll);
        System.out.println("Enter Full Name:");
        String full_name=sc.nextLine();
        setFull_name(full_name);
        System.out.println("Enter Father/Guardian's Name:");
        String Father_Name=sc.nextLine();
        setFather_Name(Father_Name);
        System.out.println("Enter Batch: ");
        int batch=Integer.parseInt(sc.nextLine());
        setBatch(batch);
        System.out.println("Enter Department name:");
        String dept=sc.nextLine();
        setDept(dept);
   
  }
}
Output
Of
Project 1 
OUTPUT OF
PROJECT 2:
OUTPUT OF
PROJECT 3:
OUTPUT OF
PROJECT 4
• In this program we have used
Object Oriented concepts to
perform a Java task program and
we have a lot of new commands
and concepts that will helps us in
Conclusion our future for programming new
concepts and developing new
programs. 

You might also like