BSC IT PRACTICALS: SME4
Showing posts with label SME4. Show all posts
Showing posts with label SME4. Show all posts

Friday, February 9, 2018

Designed a class SortData that contains the method asec() and desc() in java

February 09, 2018 3
Designed a class SortData that contains the method asec() and desc() in java
import java.util.*;
class prac4A
{
Scanner input=new Scanner(System.in);
int num,i;
int arr[];
int temp=0;
public void getdata()
{
System.out.print("Enter the size of array: ");
num=input.nextInt();
arr=new int[num];
System.out.print("Enter the number: ");
for( i=0;i<num;i++)
{
arr[i]=input.nextInt();
}
}
void putdata()
{
System.out.print("Given numbers are: ");
for(i=0;i<num;i++)
{
System.out.println(arr[i]);
}
}
void asce()
{
for(i=0;i<num;i++)
{
for(int j=i+1;j<num;j++)
{
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
System.out.print("Ascending order of number are: ");
for(int i=0;i<num;i++)
{
System.out.println(arr[i]);
}
}
void desc()
{
for(i=0;i<num;i++)
{
for(int j=i+1;j<num;j++)
{
if(arr[i]<arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
System.out.print("Descending order of number are: ");
for(int i=0;i<num;i++)
{
System.out.println(arr[i]);
}
}
public static void main(String args[])
{
prac4A ob=new prac4A();
ob.getdata();
ob.putdata();
ob.asce();
ob.desc();
}
}

Write a java program to demonstrate the implementation of abstract class.

February 09, 2018 1
 Write a java program to demonstrate the implementation of abstract class.

import java.util.Scanner;
abstract class test
{
abstract void get();
}
class test1 extends test
{
void get()
{
int a,b;
Scanner ob=new Scanner(System.in);
System.out.print("Enter 1st Number: ");
a=ob.nextInt();
System.out.println("Enter 2st Number: ");
b=ob.nextInt();
System.out.println("Addition is: "+(a+b));
}
}
class prac4C
{
public static void main(String args[])
{
test1 obj=new test1();
obj.get();
}
}

Designed a class that demonstrates the use of constructor and destructor in java

February 09, 2018 32
Designed a class that demonstrates the use of constructor and destructor in java

class xyz
{
xyz()
{
System.out.println("Constructor method........");
}
protected void finalize()
{
System.out.print("Garbage Collected.....");
}
}
class prac4B
{
public static void main(String args[])
{
xyz ob=new xyz();
ob=null;
System.gc();
}
}

Friday, January 19, 2018

Java function that calculates the sum of digits for a given char array consisting of the digits '0' to '9'. The function should return the digit sum as a long value

January 19, 2018 0
Java function that calculates the sum of digits for a given char array consisting of the digits '0' to '9'. The function should return the digit sum as a long value

CODE:

import java.util.*;
class prac3B
{
public static void main(String args[])
{
Scanner ob=new Scanner(System.in);
System.out.print("Enter the any string: ");
String s=ob.nextLine();
count(s);
}

public static void count(String str)
{
int sum=0;
int d=0;
char ch[]=str.toCharArray();
for(int i=0;i<str.length();i++)
{
if(Character.isDigit(ch[i]))
{
sum+=Character.getNumericValue(ch[i]);
}

}
System.out.println("Your addtion is: "+sum);
}
}

Find the smallest and largest element from the array in java

January 19, 2018 0
 Find the smallest and largest element from the array in java

CODE:

class prac3C
{
  public static void main(String args[])
  {
  
     int num[]=new int[]{10,20,30,5};
int s=num[0];
int l=num[0];
for(int i=0;i<num.length;i++)
{
    if(l<num[i])
{
  l=num[i];
  }
  else
  {
    s=num[i];
}
}
System.out.println("Largest Number are:"+l);
System.out.println("Smallest number are: "+s);

}}

Java program to count the letters, spaces, numbers and other characters of an input string

January 19, 2018 1
Java program to count the letters, spaces, numbers and other characters of an input string

CODE:
import java.util.*;
class prac3A
{
public static void main(String args[])
{
    Scanner input=new Scanner(System.in);
System.out.print("Enter A String: ");
String str=input.nextLine();
     int letter=0,space=0,digit=0,other=0;
   char ch[]=str.toCharArray();
for(int i=0;i<str.length();i++)
{
   if(Character.isLetter(ch[i]))
   {
       letter++;
  }
  else if(Character.isDigit(ch[i]))
  {
     digit++;
}
else if(Character.isSpaceChar(ch[i]))
           {
      space++;
  }
  else{
   other++;
   }
   }
System.out.println("Letter are: "+letter);
System.out.println("Space are: "+space);
System.out.println("Digit are: "+digit);
System.out.println("Other: "+other);    
}

}

Monday, January 15, 2018

Develop the program for Bresenham’s Line drawing algorithm in C++

January 15, 2018 0
  Develop the program for Bresenham’s Line drawing algorithm in C++

CODE:

#include<graphics.h>
#include<iostream.h>
#include<math.h>
#include<conio.h>

void main( )
{
    float x,y,x1,y1,x2,y2,dx,dy,e;
    int i,gd,gm;
    gd=DETECT;
    initgraph(&gd,&gm,"c:\\turboc3\\bgi");

    cout<<"Enter the value of x1 and y1 : ";
    cin>>x1>>y1;
    cout<<"Enter the value of x2 and y2: ";
    cin>>x2>>y2;

    dx=abs(x2-x1);
    dy=abs(y2-y1);
    x=x1;y=y1;
e=(dy/dx)-0.5;
putpixel(x,y,15);
for(i=1;i<=dx;i++){
while(e>=0){
y=y+1;
e=e-1;

}
x=x+1;
e=dy/dx+e;
putpixel(x,y,15);

}
getch();
closegraph();

}

Develop the program for DDA Line drawing algorithm in c++

January 15, 2018 0
Develop the program for DDA Line drawing algorithm in c++

CODE:

#include <graphics.h>
#include <iostream.h>
#include <math.h>


void main( )
{
    float x,y,x1,y1,x2,y2,dx,dy,step;
    int i,gd=DETECT,gm;

    initgraph(&gd,&gm,"c:\\turboc3\\bgi");

    cout<<"Enter the value of x1 and y1 : ";
    cin>>x1>>y1;
    cout<<"Enter the value of x2 and y2: ";
    cin>>x2>>y2;

    dx=abs(x2-x1);
    dy=abs(y2-y1);

    if(dx>=dy)
        step=dx;
    else
        step=dy;

    dx=dx/step;
    dy=dy/step;

    x=x1;
    y=y1;

    i=1;
    while(i<=step)
    {
        putpixel(x,y,5);
        x=x+dx;
        y=y+dy;
        i=i+1;
        delay(100);
    }

    closegraph();

}

Saturday, January 13, 2018

COMPUTER NETWORK SEM 4 ALL PRACTICAES

January 13, 2018 0
COMPUTER NETWORK SEM 4 ALL PRACTICAES
List of Practical :
1.

IPv4 Addressing and Subnetting
a)     Given an IP address and network mask, determine other information about the IP address such as:
• Network address
• Network broadcast address
• Total number of host bits
• Number of hosts

b) Given an IP address and network mask, determine other information about the IP address such as: • The subnet address of this subnet
• The broadcast address of this subnet
• The range of host addresses for this subnet
• The maximum number of subnets for this subnet mask
• The number of hosts for each subnet
• The number of subnet bits
• The number of this subnet


2.

Use of ping and tracert / traceroute, ipconfig / ifconfig, route and arp utilities.
3.

Configure IP static routing.
4.

Configure IP routing using RIP.
5.

Configuring Simple OSPF.
6.

Configuring DHCP server and client.
7.

Create virtual PC based network using virtualization software and virtual NIC.
8.

Configuring DNS Server and client.
9.

Configuring OSPF with multiple areas.
10.

Use of Wireshark to scan and check the packet information of following protocols
• HTTP
• ICMP
• TCP
• SMTP
• POP3



 DOWNLOAD PRACTICALS

CORE JAVA PRACTICLE LIST

January 13, 2018 0
CORE JAVA PRACTICLE LIST
List of Practical :
1. Java Basics
a. Write a Java program that takes a number as input and prints its multiplication table
upto 10.
b. Write a Java program to display the following pattern.
*****
****
***
**
*
c. Write a Java program to print the area and perimeter of a circle.
2. Use of Operators
a. Write a Java program to add two binary numbers.
b. Write a Java program to convert a decimal number to binary number and vice versa.
c. Write a Java program to reverse a string.
3. Java Data Types
a. Write a Java program to count the letters, spaces, numbers and other characters of
an input string.
b. Implement a Java function that calculates the sum of digits for a given char array
consisting of the digits '0' to '9'. The function should return the digit sum as a long
value.
c. Find the smallest and largest element from the array
4. Methods and Constructors
a. Designed a class SortData that contains the method asec() and desc().
b. Designed a class that demonstrates the use of constructor and destructor.
c. Write a java program to demonstrate the implementation of abstract class.
5. Inheritance
a. Write a java program to implement single level inheritance.
b. Write a java program to implement method overriding
c. Write a java program to implement multiple inheritance.
6. Packages and Arrays
a. Create a package, Add the necessary classes and import the package in java class.
b. Write a java program to add two matrices and print the resultant matrix.
c. Write a java program for multiplying two matrices and print the product for the
same.
7. Vectors and Multithreading
a. Write a java program to implement the vectors.
b. Write a java program to implement thread life cycle.
c. Write a java program to implement multithreading.
8. File Handling
a. Write a java program to open a file and display the contents in the console
window.
b. Write a java program to copy the contents from one file to other file.
c. Write a java program to read the student data from user and store it in the file.
9. GUI and Exception Handling
a. Design a AWT program to print the factorial for an input value.
b. Design an AWT program to perform various string operations like reverse string,
string concatenation etc.
c. Write a java program to implement exception handling.
10. GUI Programming.
a. Design an AWT application that contains the interface to add student information
and display the same.
b. Design a calculator based on AWT application.

c. Design an AWT application to generate result marks sheet.

Computer Graphics and Animation Practicle List

January 13, 2018 0
Computer Graphics and Animation Practicle List

List of Practical
1.
Solve the following:
a.

Study and enlist the basic functions used for graphics in C / C++ / Python language. Give an example for each of them.
b.
Draw a co-ordinate axis at the center of the screen.
2.
Solve the following:
a.
Divide your screen into four region, draw circle, rectangle, ellipse and half ellipse in each region with appropriate message.
b.
Draw a simple hut on the screen.
3.
Draw the following basic shapes in the center of the screen :

i .Circle
ii. Rectangle
iii. Square
iv. Concentric Circles
v. Ellipse
vi. Line
4.
Solve the following:
a.
Develop the program for DDA Line drawing algorithm.
b.
Develop the program for Bresenham’s Line drawing algorithm.
5.
Solve the following:
a.
Develop the program for the mid-point circle drawing algorithm.
b.
Develop the program for the mid-point ellipse drawing algorithm.
6.
Solve the following:
a.
Write a program to implement 2D scaling.
b.
Write a program to perform 2D translation
7.
Solve the following:
a.
Perform 2D Rotation on a given object.
b.
Program to create a house like figure and perform the following operations.
i. Scaling about the origin followed by translation.
ii. Scaling with reference to an arbitrary point.
iii. Reflect about the line y = mx + c.
8.
Solve the following:
a.
Write a program to implement Cohen-Sutherland clipping.
b.
Write a program to implement Liang - Barsky Line Clipping Algorithm
9.
Solve the following:
a.
Write a program to fill a circle using Flood Fill Algorithm.
b.
Write a program to fill a circle using Boundary Fill Algorithm.
10.
Solve the following:
a.
Develop a simple text screen saver using graphics functions.
b.
Perform smiling face animation using graphic functions.
c.
Draw the moving car on the screen.