Note : This Blog Has No Concerns With Any Of The College Institute.
Developed & Maintained By RAJ SAHIN N.
...::: Recent Updates :::...
Saturday, November 26, 2011
Thursday, November 24, 2011
System Software Notes By Me.
System Software
UNIT 3
Chapter 5
----------------------------
RAJ SOLUTION'S
www.licamca.blogspot.com
www.sahinraj.blogspot.com
Wednesday, November 23, 2011
Tuesday, September 27, 2011
CardLayout
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.CardLayout;
import java.awt.Container;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
class cardlayout implements ActionListener
{
static CardLayout cl;
static JFrame jf;
static JButton[] jb = new JButton[5];
static Container ct;
public static void main(String args[])
{
/* JFrame Object instansiated */
jf=new JFrame("Maulin");
/* toolkit to get screen size */
Toolkit tk=jf.getToolkit();
Dimension dm=tk.getScreenSize();
jf.setBounds(dm.width/4,dm.width/4,dm.height/2,dm.height/2);
/* Card Layout instansiated*/
cl=new CardLayout(50,50);
/*get contentpane of JFrame which return Container */
Container ct=jf.getContentPane();
/* set Card Layout for Container */
ct.setLayout(cl);
for(int i=0;i<5;i++)
{
jb[i]=new JButton("Maulin"+i);
jb[i].addActionListener(new cardlayout());
}
for(int i=0;i<5;i++)
{
/*Adding Button to Container(JFrame)*/
ct.add(jb[i],"Maulin"+i);
}
/*First Card Display on Screen :) First Button display*/
cl.show(jf.getContentPane(),"Maulin"+2);
jf.setVisible(true);
/*Destroy the Frame*/
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
cl.next(jf.getContentPane());
}
}
import javax.swing.JButton;
import java.awt.CardLayout;
import java.awt.Container;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
class cardlayout implements ActionListener
{
static CardLayout cl;
static JFrame jf;
static JButton[] jb = new JButton[5];
static Container ct;
public static void main(String args[])
{
/* JFrame Object instansiated */
jf=new JFrame("Maulin");
/* toolkit to get screen size */
Toolkit tk=jf.getToolkit();
Dimension dm=tk.getScreenSize();
jf.setBounds(dm.width/4,dm.width/4,dm.height/2,dm.height/2);
/* Card Layout instansiated*/
cl=new CardLayout(50,50);
/*get contentpane of JFrame which return Container */
Container ct=jf.getContentPane();
/* set Card Layout for Container */
ct.setLayout(cl);
for(int i=0;i<5;i++)
{
jb[i]=new JButton("Maulin"+i);
jb[i].addActionListener(new cardlayout());
}
for(int i=0;i<5;i++)
{
/*Adding Button to Container(JFrame)*/
ct.add(jb[i],"Maulin"+i);
}
/*First Card Display on Screen :) First Button display*/
cl.show(jf.getContentPane(),"Maulin"+2);
jf.setVisible(true);
/*Destroy the Frame*/
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
cl.next(jf.getContentPane());
}
}
Friday, September 23, 2011
Develop an application which is having one rectangle and three textboxes of Red, Green, and Blue (i.e. RGB). As the value of RGB Textbox changing the fill color of rectangle should change.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
JAVA APPLET PROGRAM
RBG Program
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Develop an application which is having one rectangle and three textboxes of Red, Green, and Blue (i.e. RGB). As the value of RGB Textbox changing the fill color of rectangle should change.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
NAME : SAHIN NISAR RAJ
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
package session9;
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JOptionPane;
public class S9Q5 extends Applet implements KeyListener,ActionListener
{
int vred = 20;
int vgreen = 30;
int vblue = 40;
TextField red;
TextField green;
TextField blue;
Label lbred;
Label lbgreen;
Label lbblue;
Button Change;
@Override
public void init()
{
setLayout(null);
red = new TextField(20);
green = new TextField(20);
blue = new TextField(20);
lbred = new Label("Red :");
lbgreen = new Label("Green :");
lbblue = new Label("Blue :");
Change = new Button("Change");
add(red);
red.setBackground(Color.red);
add(green);
green.setBackground(Color.green);
add(blue);
blue.setBackground(Color.blue);
add(lbred);
lbred.setBackground(Color.gray);
lbred.setForeground(Color.white);
add(lbgreen);
lbgreen.setBackground(Color.gray);
lbgreen.setForeground(Color.white);
add(lbblue);
lbblue.setBackground(Color.gray);
lbblue.setForeground(Color.white);
add(Change);
red.setBounds(230,30,100,20);
green.setBounds(230,50,100,20);
blue.setBounds(230,70,100,20);
lbred.setBounds(180,30,100,20);
lbgreen.setBounds(180,50,100,20);
lbblue.setBounds(180,70,100,20);
Change.setBounds(180,100, 150, 30);
red.addKeyListener(this);
green.addKeyListener(this);
blue.addKeyListener(this);
Change.addActionListener(this);
setBackground(Color.GRAY);
}
@Override
public void paint(Graphics g)
{
try
{
Color c = new Color(vred,vgreen,vblue);
g.setColor(c);
g.fillRect(20, 20,130,100);
g.drawString("* Range Must be Between 0 - 255", 90, 180);
} catch (Exception e)
{
JOptionPane.showMessageDialog(null,e.getMessage());
}
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == Change)
{
this.vblue = Integer.parseInt(blue.getText().toString());
this.vgreen = Integer.parseInt(green.getText().toString());
this.vred = Integer.parseInt(red.getText().toString());
repaint();
}
}
}
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JOptionPane;
public class S9Q5 extends Applet implements KeyListener,ActionListener
{
int vred = 20;
int vgreen = 30;
int vblue = 40;
TextField red;
TextField green;
TextField blue;
Label lbred;
Label lbgreen;
Label lbblue;
Button Change;
@Override
public void init()
{
setLayout(null);
red = new TextField(20);
green = new TextField(20);
blue = new TextField(20);
lbred = new Label("Red :");
lbgreen = new Label("Green :");
lbblue = new Label("Blue :");
Change = new Button("Change");
add(red);
red.setBackground(Color.red);
add(green);
green.setBackground(Color.green);
add(blue);
blue.setBackground(Color.blue);
add(lbred);
lbred.setBackground(Color.gray);
lbred.setForeground(Color.white);
add(lbgreen);
lbgreen.setBackground(Color.gray);
lbgreen.setForeground(Color.white);
add(lbblue);
lbblue.setBackground(Color.gray);
lbblue.setForeground(Color.white);
add(Change);
red.setBounds(230,30,100,20);
green.setBounds(230,50,100,20);
blue.setBounds(230,70,100,20);
lbred.setBounds(180,30,100,20);
lbgreen.setBounds(180,50,100,20);
lbblue.setBounds(180,70,100,20);
Change.setBounds(180,100, 150, 30);
red.addKeyListener(this);
green.addKeyListener(this);
blue.addKeyListener(this);
Change.addActionListener(this);
setBackground(Color.GRAY);
}
@Override
public void paint(Graphics g)
{
try
{
Color c = new Color(vred,vgreen,vblue);
g.setColor(c);
g.fillRect(20, 20,130,100);
g.drawString("* Range Must be Between 0 - 255", 90, 180);
} catch (Exception e)
{
JOptionPane.showMessageDialog(null,e.getMessage());
}
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == Change)
{
this.vblue = Integer.parseInt(blue.getText().toString());
this.vgreen = Integer.parseInt(green.getText().toString());
this.vred = Integer.parseInt(red.getText().toString());
repaint();
}
}
}
Sunday, September 18, 2011
Mod Convertor Java Applets
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
JAVA APPLET PROGRAM
( Mod Converter )
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
2. Create applet for Mod Convertor which converts from different bases to base 10.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
NAME : SAHIN NISAR RAJ
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
package session9;
//Create applet for Mod Convertor which converts from different bases to base 10.
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Label;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JOptionPane;
public class S9Q3 extends Applet implements ActionListener,KeyListener
{
Button Convert;
Label lb_Num;
Label lb_Base;
Label devl;
Button Clear;
TextField Num,Base;
TextArea Res;
int i=0;
@Override
public void init()
{
setSize(210,300);
setBackground(Color.LIGHT_GRAY);
Convert = new Button("Convert");
Clear = new Button("Clear");
lb_Num = new Label("Number");
lb_Base = new Label("Base");
devl = new Label("Developed By : RAJ SAHIN N.");
Num = new TextField(20);
Base = new TextField(20);
Res = new TextArea(3,25);
add(lb_Num);
add(Num);
add(lb_Base);
add(Base);
add(Convert);
add(Clear);
add(Res);
add(devl);
Convert.setBackground(Color.white);
Clear.setBackground(Color.white);
Convert.addActionListener(this);
Clear.addActionListener(this);
devl.setForeground(Color.red);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == Convert)
{
try
{
int oprand,div= 0;
StringBuffer res;
oprand = Integer.parseInt(Num.getText());
div = Integer.parseInt(Base.getText());
res = Calculation(oprand,div);
Res.setText("00"+res.reverse().toString());
} catch (Exception ex)
{
JOptionPane.showMessageDialog(this,"Please Enter Valid Input Values");
}
}
if(e.getSource() == Clear)
{
Num.setText("");
Base.setText("");
Res.setText("");
}
}
public StringBuffer Calculation(int operand,int div)
{
StringBuffer trans = new StringBuffer();
do
{
trans.append(operand % div);
operand = operand / div;
this.i++;
}while(operand != 0);
return trans;
}
}
//Create applet for Mod Convertor which converts from different bases to base 10.
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Label;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JOptionPane;
public class S9Q3 extends Applet implements ActionListener,KeyListener
{
Button Convert;
Label lb_Num;
Label lb_Base;
Label devl;
Button Clear;
TextField Num,Base;
TextArea Res;
int i=0;
@Override
public void init()
{
setSize(210,300);
setBackground(Color.LIGHT_GRAY);
Convert = new Button("Convert");
Clear = new Button("Clear");
lb_Num = new Label("Number");
lb_Base = new Label("Base");
devl = new Label("Developed By : RAJ SAHIN N.");
Num = new TextField(20);
Base = new TextField(20);
Res = new TextArea(3,25);
add(lb_Num);
add(Num);
add(lb_Base);
add(Base);
add(Convert);
add(Clear);
add(Res);
add(devl);
Convert.setBackground(Color.white);
Clear.setBackground(Color.white);
Convert.addActionListener(this);
Clear.addActionListener(this);
devl.setForeground(Color.red);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == Convert)
{
try
{
int oprand,div= 0;
StringBuffer res;
oprand = Integer.parseInt(Num.getText());
div = Integer.parseInt(Base.getText());
res = Calculation(oprand,div);
Res.setText("00"+res.reverse().toString());
} catch (Exception ex)
{
JOptionPane.showMessageDialog(this,"Please Enter Valid Input Values");
}
}
if(e.getSource() == Clear)
{
Num.setText("");
Base.setText("");
Res.setText("");
}
}
public StringBuffer Calculation(int operand,int div)
{
StringBuffer trans = new StringBuffer();
do
{
trans.append(operand % div);
operand = operand / div;
this.i++;
}while(operand != 0);
return trans;
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Java Program Which Show a Rectangle That Will Change Color When The Mouse Moves Over It.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
JAVA APPLET PROGRAM
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
2. Write a java program to create applet which will show a rectangle that will change color when the mouse moves over it.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
NAME : SAHIN NISAR RAJ
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
public class S9Q2 extends Applet implements ActionListener,KeyListener,MouseMotionListener
{
int rectx;
int recty;
int rectwidth;
int rectheight;
int mx,my,mw,mh;
@Override
public void init()
{
rectx = 20;
recty = 20;
rectwidth = 200;
rectheight = 100;
addMouseMotionListener(this);
}
public void paint(Graphics g)
{
if((mx>rectx && my>recty) && (mx<rectx+rectwidth && my<recty+rectheight))
{
g.setColor(Color.MAGENTA);
g.fillRect(rectx,recty,rectwidth,rectheight);
}
else
{
g.setColor(Color.red);
g.fillRect(rectx,recty,rectwidth,rectheight);
}
}
public void mouseMoved(MouseEvent e)
{
mx = e.getX();
my = e.getY();
repaint();
}
}
{
int rectx;
int recty;
int rectwidth;
int rectheight;
int mx,my,mw,mh;
@Override
public void init()
{
rectx = 20;
recty = 20;
rectwidth = 200;
rectheight = 100;
addMouseMotionListener(this);
}
public void paint(Graphics g)
{
if((mx>rectx && my>recty) && (mx<rectx+rectwidth && my<recty+rectheight))
{
g.setColor(Color.MAGENTA);
g.fillRect(rectx,recty,rectwidth,rectheight);
}
else
{
g.setColor(Color.red);
g.fillRect(rectx,recty,rectwidth,rectheight);
}
}
public void mouseMoved(MouseEvent e)
{
mx = e.getX();
my = e.getY();
repaint();
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Download Source : Click Here...
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Tuesday, September 13, 2011
Threading in JAVA
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
THREADING IN JAVA
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Q Create two Thread subclasses, one with a run( ) that starts up and then calls wait( ). The other class’ run( ) should capture the reference of the first Thread object. Its run( ) should call notifyAll( ) for the first thread after some number of seconds have passed, so the first thread can print a message.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
NAME : SAHIN NISAR RAJ
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
package session8threads;class Thread1 implements Runnable
{
Thread thrd1;
Thread1()
{
thrd1 = new Thread(this,"Thread One");
thrd1.start();
}
public void run()
{
try
{
System.out.println("Thread First Started");
synchronized(this)
{
System.out.println("Thread First Entering into Wait State");
this.wait(20000);
System.out.println("Thread First Resumed after Notify");
}
} catch (Exception e)
{
System.out.println("Exception in First Thread" +e.getMessage());
}
}
}
class Thread2 implements Runnable
{
Thread thrd2;
Thread1 temp;
Thread2(Thread1 th)
{
thrd2 = new Thread(this,"Thread Two");
temp = th;
thrd2.start();
}
public void run()
{
try
{
System.out.println("Thread Two Started");
synchronized(temp)
{
System.out.println("Thread Two Notified Thread First");
temp.notify();
}
} catch (Exception e)
{
System.out.println("Exception in Second Thread" +e.getMessage());
}
}
}
public class Main
{
public static void main(String[] args)
{
Thread1 thrd1 = new Thread1();
Thread2 thrd2 = new Thread2(thrd1);
}
}
Sunday, September 11, 2011
FileHandling With StatisticalData In JAVA.
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
A college maintains the information about the marks of the students of a class in a text file with fixed record length. Each line in the file contains data of one student. The first 15 characters have the name of the student, next 12 characters have marks in the four subjects, and each subject has 3 characters. Create a class called StudentMarks, which has student Name, and marks for four subjects. Provide appropriate getter methods and constructors, for this class. Write an application class to load the file into an array of Student Marks. Use the StatisticalData class to compute the statistics mean, median for each of the subjects in the class.------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
NAME : SAHIN NISAR RAJ
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
ENROLL : 105200693009
COLLEGE : LAXMI INSTITUTE OF COMPUTER APPLICATIONS
Thanks Sir For Helping
Manjoor Hussain Kapoor
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Main.java
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
package filehandling;import java.util.ArrayList;
public class Main
{
public static void main(String[] args)
{
ArrayList<String> MyArr;
ArrayList<String> Name;
ArrayList<String> Java;
ArrayList<String> OS;
ArrayList<String> SS;
ArrayList<String> SM;
ArrayList<Float> Mean;
ArrayList<Float> Median;
new WriteFile("FileHandling.txt").WriteToFile();
MyArr = new ReadFile("FileHandling.txt").ReadFromFile();
Name = new ArrayList<String>();
Java = new ArrayList<String>();
OS = new ArrayList<String>();
SS = new ArrayList<String>();
SM = new ArrayList<String>();
Mean = new ArrayList<Float>();
Median = new ArrayList<Float>();
for(int i=0;i<MyArr.size();i++)
{
Name.add(MyArr.get(i).substring(0,15));
Java.add(MyArr.get(i).substring(15,18));
OS.add(MyArr.get(i).substring(18,21));
SS.add(MyArr.get(i).substring(21,24));
SM.add(MyArr.get(i).substring(24));
}
Mean.add(mean(Java));
Mean.add(mean(OS));
Mean.add(mean(SS));
Mean.add(mean(SM));
Median.add(median(Java));
Median.add(median(OS));
Median.add(median(SS));
Median.add(median(SM));
DisplayMean(Mean);
DisplayMedian(Median);
}
public static float mean(ArrayList<String> sub)
{
float mean,total = 0;
for(int i=0;i<sub.size();i++)
{
total = total + Integer.parseInt(sub.get(i).trim());
}
mean = total/sub.size();
return mean;
}
public static float median(ArrayList<String> sub)
{
float median = 0;
int tmp=((sub.size()+1)/2);
if(sub.size()%2==0)
{
median= (Float.parseFloat(sub.get(tmp-1)) + Float.parseFloat(sub.get(tmp)))/2;
}
else
{
median=Float.parseFloat(sub.get(tmp));
}
return median;
}
public static void DisplayMean(ArrayList<Float> Mean)
{
System.out.println("Mean Of All Subject");
System.out.println("JAVA "+Mean.get(0));
System.out.println("OS "+Mean.get(1));
System.out.println("SS "+Mean.get(2));
System.out.println("SM "+Mean.get(3));
}
public static void DisplayMedian(ArrayList<Float> Median)
{
System.out.println("Median Of All Subject");
System.out.println("JAVA "+Median.get(0));
System.out.println("OS "+Median.get(1));
System.out.println("SS "+Median.get(2));
System.out.println("SM "+Median.get(3));
}
}
public class Main
{
public static void main(String[] args)
{
ArrayList<String> MyArr;
ArrayList<String> Name;
ArrayList<String> Java;
ArrayList<String> OS;
ArrayList<String> SS;
ArrayList<String> SM;
ArrayList<Float> Mean;
ArrayList<Float> Median;
new WriteFile("FileHandling.txt").WriteToFile();
MyArr = new ReadFile("FileHandling.txt").ReadFromFile();
Name = new ArrayList<String>();
Java = new ArrayList<String>();
OS = new ArrayList<String>();
SS = new ArrayList<String>();
SM = new ArrayList<String>();
Mean = new ArrayList<Float>();
Median = new ArrayList<Float>();
for(int i=0;i<MyArr.size();i++)
{
Name.add(MyArr.get(i).substring(0,15));
Java.add(MyArr.get(i).substring(15,18));
OS.add(MyArr.get(i).substring(18,21));
SS.add(MyArr.get(i).substring(21,24));
SM.add(MyArr.get(i).substring(24));
}
Mean.add(mean(Java));
Mean.add(mean(OS));
Mean.add(mean(SS));
Mean.add(mean(SM));
Median.add(median(Java));
Median.add(median(OS));
Median.add(median(SS));
Median.add(median(SM));
DisplayMean(Mean);
DisplayMedian(Median);
}
public static float mean(ArrayList<String> sub)
{
float mean,total = 0;
for(int i=0;i<sub.size();i++)
{
total = total + Integer.parseInt(sub.get(i).trim());
}
mean = total/sub.size();
return mean;
}
public static float median(ArrayList<String> sub)
{
float median = 0;
int tmp=((sub.size()+1)/2);
if(sub.size()%2==0)
{
median= (Float.parseFloat(sub.get(tmp-1)) + Float.parseFloat(sub.get(tmp)))/2;
}
else
{
median=Float.parseFloat(sub.get(tmp));
}
return median;
}
public static void DisplayMean(ArrayList<Float> Mean)
{
System.out.println("Mean Of All Subject");
System.out.println("JAVA "+Mean.get(0));
System.out.println("OS "+Mean.get(1));
System.out.println("SS "+Mean.get(2));
System.out.println("SM "+Mean.get(3));
}
public static void DisplayMedian(ArrayList<Float> Median)
{
System.out.println("Median Of All Subject");
System.out.println("JAVA "+Median.get(0));
System.out.println("OS "+Median.get(1));
System.out.println("SS "+Median.get(2));
System.out.println("SM "+Median.get(3));
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
ReadFile.java
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
package filehandling;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Scanner;
public class ReadFile
{
FileInputStream fip;
Scanner sc;
String FileName;
ArrayList<String> MyArr;
int i=0;
ReadFile(String FileName)
{
this.FileName = FileName;
}
public ArrayList ReadFromFile()
{
try
{
fip = new FileInputStream(FileName);
sc = new Scanner(fip);
MyArr = new ArrayList<String>();
while(sc.hasNextLine())
{
String Str = sc.nextLine();
MyArr.add(Str);
Str = null;
}
} catch (Exception ex)
{
System.out.println("Exception in ReadFromFile : " + ex.getMessage());
}
return MyArr;
}
}
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Scanner;
public class ReadFile
{
FileInputStream fip;
Scanner sc;
String FileName;
ArrayList<String> MyArr;
int i=0;
ReadFile(String FileName)
{
this.FileName = FileName;
}
public ArrayList ReadFromFile()
{
try
{
fip = new FileInputStream(FileName);
sc = new Scanner(fip);
MyArr = new ArrayList<String>();
while(sc.hasNextLine())
{
String Str = sc.nextLine();
MyArr.add(Str);
Str = null;
}
} catch (Exception ex)
{
System.out.println("Exception in ReadFromFile : " + ex.getMessage());
}
return MyArr;
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
WriteFile.java
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
package filehandling;import java.io.FileOutputStream;
public class WriteFile
{
FileOutputStream fop;
String FileName;
WriteFile(String FileName)
{
this.FileName = FileName;
}
public void WriteToFile()
{
try
{
fop = new FileOutputStream(FileName);
fop.write("SAHIN 90 87 65 78 \n".getBytes());
fop.write("RAJ 80 69 54 67 \n".getBytes());
fop.write("KAUSHAL 62 37 52 65 \n".getBytes());
fop.write("BHUMIKA 74 39 81 57 \n".getBytes());
fop.write("VIKAS 56 61 91 48 \n".getBytes());
fop.close();
} catch (Exception ex)
{
System.out.println("Exception in WriteToFile : " +ex.getMessage());
}
}
}
public class WriteFile
{
FileOutputStream fop;
String FileName;
WriteFile(String FileName)
{
this.FileName = FileName;
}
public void WriteToFile()
{
try
{
fop = new FileOutputStream(FileName);
fop.write("SAHIN 90 87 65 78 \n".getBytes());
fop.write("RAJ 80 69 54 67 \n".getBytes());
fop.write("KAUSHAL 62 37 52 65 \n".getBytes());
fop.write("BHUMIKA 74 39 81 57 \n".getBytes());
fop.write("VIKAS 56 61 91 48 \n".getBytes());
fop.close();
} catch (Exception ex)
{
System.out.println("Exception in WriteToFile : " +ex.getMessage());
}
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Download Full Program : Click Here
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Thanks For Help
Manjoor Hussain Kapoor
Manjoor Hussain Kapoor
------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
Sunday, September 4, 2011
Filter File in java (display only a*.java) files
import java.io.FilenameFilter;
import java.io.File;
class filterfilelist implements FilenameFilter
{
String FileName;
String Extention;
String startwith;
String endswith;
String inbetween_startwith,inbetween_endswith;
filterfilelist(String tmp)
{
FileName=tmp.substring(0,(tmp.indexOf('.')));
System.out.println("Name:-"+FileName);
Extention=tmp.substring((tmp.indexOf('.')+1));
System.out.println("Extension:-"+Extention);
}
public boolean accept(File dir,String file)
{
boolean m=true;
String f1=" ";
/* If Star Place At First Place *a.java */
int len=FileName.length()-1;
if(FileName.indexOf('*')==0)
{
startwith=FileName.substring((FileName.indexOf('*')+1));
if(file.indexOf('.')!= -1)
{
f1=file.substring(0,(file.indexOf('.')));
}
m = f1.endsWith(startwith) && file.endsWith(Extention);
}/* a*.java */
if(FileName.indexOf('*')==len)
{
endswith=FileName.substring(0,(FileName.indexOf('*')));
m = file.startsWith(endswith) && file.endsWith(Extention);
}
/* else a*b.java Still remain
{
inbetween_startwith=FileName.substring(0,(FileName.indexOf('*')));
inbetween_endswith=FileName.substring((FileName.indexOf('*')+1));
m =file.startsWith(inbetween_endswith) & file.endsWith(inbetween_startwith) & file.endsWith(Extention);
}*/
return m;
}
}
import java.io.File;
class filterfilelist implements FilenameFilter
{
String FileName;
String Extention;
String startwith;
String endswith;
String inbetween_startwith,inbetween_endswith;
filterfilelist(String tmp)
{
FileName=tmp.substring(0,(tmp.indexOf('.')));
System.out.println("Name:-"+FileName);
Extention=tmp.substring((tmp.indexOf('.')+1));
System.out.println("Extension:-"+Extention);
}
public boolean accept(File dir,String file)
{
boolean m=true;
String f1=" ";
/* If Star Place At First Place *a.java */
int len=FileName.length()-1;
if(FileName.indexOf('*')==0)
{
startwith=FileName.substring((FileName.indexOf('*')+1));
if(file.indexOf('.')!= -1)
{
f1=file.substring(0,(file.indexOf('.')));
}
m = f1.endsWith(startwith) && file.endsWith(Extention);
}/* a*.java */
if(FileName.indexOf('*')==len)
{
endswith=FileName.substring(0,(FileName.indexOf('*')));
m = file.startsWith(endswith) && file.endsWith(Extention);
}
/* else a*b.java Still remain
{
inbetween_startwith=FileName.substring(0,(FileName.indexOf('*')));
inbetween_endswith=FileName.substring((FileName.indexOf('*')+1));
m =file.startsWith(inbetween_endswith) & file.endsWith(inbetween_startwith) & file.endsWith(Extention);
}*/
return m;
}
}
Monday, August 8, 2011
Operating Systems (OS)
Main Reference Book
Stalling W, “Operating Systems”, 6th edition, Prentice Hall India.
Download Now E-book
Presentation & Reading Material By Our Faculty
Chapter 1
Computer System Overview I
Chapter 2
Computer System Overview II
Chapter 3
Process Description & Control
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Friday, July 8, 2011
Core Java Fundamentals eighth Edition
DOWNLOAD NOW
Special Thanks
www.dbebooks.com
&
www.gtuexam.in
From:
------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------
Jones_Artificial Intelligence-A Systems Approach
Special Thanks
www.dbebooks.com
&
www.gtuexam.in------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Tuesday, July 5, 2011
Operating Systems (OS)
Main Reference Book
Stalling W, “Operating Systems”, 6th edition, Prentice Hall India.
Download Now
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Sunday, July 3, 2011
Develop Android
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Java 2 - The Complete Reference
Special Thanks
Zinkal Patel
For Sharing This book
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Saturday, July 2, 2011
HACKING TIPS By-Ankit Fadia
HACKING TIPS
By-Ankit Fadia
Special Thanks To Ankit Fadia
From
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Artificial_Crime_Analysis_Systems
Artificial Crime Analysis Systems
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
MCA_SEM - III & SEM - IV Syllabus
G T U
MASTER OF COMPUTER APPLICATION
Proposed Subjects and Teaching Scheme
Semester-III
- 630001 Structured & Object Oriented Analysis & Design Methodology (SOOADM)
- 630002 Fundamentals of Java Programming (Java)
- 630003 Statistical Methods (SM)
- 630004 Operating Systems (OS)
- 630005 System Software (SS)
- 630006 Programming Skills-IV (Java)
- 630007 Programming Skills-V (OS)
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Wednesday, June 1, 2011
NEW ** FULL DATA STRUCTURES
Note : Due To Some Security Reasons all The Files Are Kept Password Protected So Those Who Want To Download These Files Just Comment (Reply) Ur Email Address With Ur Name and College Name. Ill Be Sending You Password In Mail ASAP!
...::: Binary Trees by Nick Parlante :::...
...::: Questions On Tree :::...
...::: Questions On Searching & Sorting :::...
...::: Notes on Searching & Sorting By Manjoor Kapoor :::...
...::: Questions On Searching & Sorting :::...
...::: Notes on Searching & Sorting By Manjoor Kapoor :::...
...::: Correct Expected Solution For D.S Question Set :::..
NEW ** FULL DATA STRUCTURES (THANKS TO " http://gtu-mca.blogspot.com " & GOOGLE )
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
NEW ** FULL DATA STRUCTURES (THANKS TO " http://gtu-mca.blogspot.com " & GOOGLE )
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
Saturday, May 28, 2011
DBMS II
[Note ** For Download Password Just Comment on this post or email me : sahinraj87@gmail.com ]
Chapter 4 Introduction to other databases by - Kaustubh Arekar
Chapter 5 Relational Algebra by - Kaustubh Arekar
Chapter 6 Query processing and optimization by - Kaustubh Arekar
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
www.licamca.blogspot.com
Thursday, May 26, 2011
E-book Prentice.Hall.CPP.Without.Fear.2nd.Edition
Note : Due To Some Security Reasons all The Files Are Kept Password Protected So Those Who Want To Download These Files Just Comment (Reply) Ur Email Address With Ur Name and College Name. Ill Be Sending You Password In Mail ASAP!
..:: NEW *** E-book Prentice.Hall.CPP.Without.Fear.2nd.Edition by - Dhaval Mehta ::..
..:: Complete Question List 620003-Object Oriented Concepts and Programming (OOCP) ::.
...::: Introduction to OOCP C++ ( 620003 ) by Dhaval Mehta :::...
...::: Chapter 4 Operator Overloading by Dhaval Mehta :::...
...::: Chapter 6 Inheritance by Dhaval Mehta :::...
..:: Short Question list by Dhaval Mehta ::..
..:: 620003: Object Oriented Concepts & Programming (OOCP) Mid Term Paper ::..
..:: OOCP Practical Exam ::..
..:: MCQ With Answers Chapter I: Principles of Object-Oriented Programming by Raj Sahin N. ::..
..:: Complete Reference Material For OOPS 620003 ::..
..:: Complete MCQ Question With Proper Solution's By Raj Sahin N. ( LICA Sem II ) ::..
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Wednesday, May 18, 2011
Program for perform merge sort using linklist
//program for perform merge sort using linklist
//writter : kartik
//27-4-11
#include<stdio.h>
#include<conio.h>
struct linklist
{
int info;
struct linklist *next;
}*start=NULL,*first=NULL,*start2,*temp,*node,*last;
typedef struct linklist lk;
void insert(lk **);
void disp(lk **);
void mergesort();
void main()
{
int ch;
char con,cn;
clrscr();
do
{
printf("\n***********************************************");
printf("\n K@rtik's Merge sort");
printf("\n***********************************************");
printf("\n 1. insert sorting data:");
printf("\n 2. display");
printf("\n 3. perform mergeing sort");
printf("\n================================================");
printf("\nenter ur choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("\n enter data for 1st linklist");
do
{
insert(&start);
fflush(0);
printf("\n do u wnt to insert more(y/n):");
scanf("%c",&cn);
}while(cn=='y');
printf("\n enter data for 2nd linklist");
do
{
insert(&first);
fflush(0);
printf("\n do u wnt to insert more(y/n):");
scanf("%c",&cn);
}while(cn=='y');
break;
case 2:
printf("\n*********>display data of 1st linklist..........");
disp(&start);
printf("\n*********>display data of 2nd linklist..........");
disp(&first);
break;
case 3:
mergesort();
break;
default:
printf("\n==> u must i/p 1 to 3 onlly.....");
}
fflush(0);
printf("\n do u wnt to con(y/n):");
scanf("%c",&con);
}while(con=='y');
getch();
}
void insert(lk **head)
{
lk *node=(lk *)malloc(sizeof(lk));
int item;
printf("\nenter item:");
scanf("%d",&item);
if((*head)==NULL)
{
(*head)=(lk *)malloc(sizeof(lk));
(*head)->info=item;
(*head)->next=NULL;
}
else
{
lk *temp=(*head);
while(temp->next!=NULL)
temp=temp->next;
node->info=item;
temp->next=node;
node->next=NULL;
}
}
void disp(lk **head)
{
lk *temp=(*head);
printf("\n");
if((*head)==NULL)
printf("\n linklist is empty");
else
{
while(temp)
{
printf("%3d",temp->info);
temp=temp->next;
}
}
}
void mergesort()
{
lk *tmp1;
lk *tmp2;
lk (*start2)=(lk *)malloc(sizeof(lk));
tmp1=start;
tmp2=first;
start2=NULL;
while((tmp1) && (tmp2))
{
temp=(lk *)malloc(sizeof(lk));
temp->next=NULL;
if(tmp1->info < tmp2->info)
{
temp->info=tmp1->info;
tmp1=tmp1->next;
}
else if(tmp1->info > tmp2->info)
{
temp->info=tmp2->info;
tmp2=tmp2->next;
}
if(start2==NULL)
{printf("\n NULL");
start2=temp;
}
else
node->next=temp;
node=temp;
last=temp;
}//end of while loop*/
while(tmp1!=NULL)
{
temp=(lk *)malloc(sizeof(lk));
temp->next=NULL;
temp->info=tmp1->info;
tmp1=tmp1->next;
node->next=temp;
node=temp;
last=temp;
}
while(tmp2!=NULL)
{
temp=(lk *)malloc(sizeof(lk));
temp->next=NULL;
temp->info=tmp2->info;
tmp2=tmp2->next;
node->next=temp;
node=temp;
last=temp;
}
printf("\n ***** after merging sort:");
disp(&start2);
}
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Program for perfomr arithmetic operation on Two Polynomials using linklist
//program for perfomr arithmetic operation on Two Polynomials using linklist
//writter : K@rtik
//20-03-11 sunday
#include<stdio.h>
#include<conio.h>
struct linklist
{
int data;
int power;
struct linklist *next;
}*fnode=NULL,*start1=NULL,*last,*start2,*start3,*snode=NULL;
typedef struct linklist lk;
int item,i,pow,c;
void insert(lk **);
void add();
void sub();
void mul();
void disp(lk **);
void main()
{
char con;
int ch;
fnode=(lk *)malloc(sizeof(lk));
snode=(lk *)malloc(sizeof(lk));
fnode=NULL;
snode=NULL;
clrscr();
do
{
printf("\n\n ********************************************************");
printf("\n K@rtik's LINKLIST OPERATION");
printf("\n\n -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
printf("\n *-----> 1.Add Polynomial equation *");
printf("\n *-----> 2.Adddition of Two Polynomial *");
printf("\n *-----> 3.Subtraction of Two Polynomial *");
printf("\n *-----> 4.Multiplication of Two Polynomial *");
printf("\n\n -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
printf("\n\n=> enter ur choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("\n Enter 1st Equation\n");
insert(&fnode);
printf("\n enter 2nd Equation\n");
insert(&snode);
printf("\n 1st Polynomial equation is====>");
disp(&fnode);
printf("\n 2nd Polynomial equation is====>");
disp(&snode);
break;
case 2:
add();
break;
case 3:
sub();
break;
case 4:
mul();
break;
default:
printf("\n u must enter any number from 1 to 5");
}
fflush(0);
printf("\n\n==> do u want to con...(Y/N)?");
scanf("%c",&con);
}while (con!='n');
getch();
}
//user define code for add item at last
void insert(lk **start)
{
lk *node,*temp,*first;
while(1)
{
if((*start)==NULL)
{
printf("\n enter an item:");
scanf("%d",&item);
printf("\n enter power:");
scanf("%d",&pow);
(*start)=(lk *)malloc(sizeof(lk));
(*start)->data=item;
(*start)->power=pow;
(*start)->next=NULL;
}
else
{
node=(lk *)malloc(sizeof(lk));
printf("\n enter an item:");
scanf("%d",&item);
l: printf("\n enter power:");
scanf("%d",&pow);
temp=(*start);
while(temp->next!=NULL)
{
if(pow >= temp->power)
{
printf("\n ==> u must i/p power value less then %d ",temp->power);
goto l;
}
temp=temp->next;
}
node->data=item;
node->power=pow;
node->next=NULL;
temp->next=node;
} //end of else
if(pow==0)
break;
}
}
//Udf for display Polynomial
void disp(lk **head)
{
lk *node,*node1;
node=(lk *)malloc(sizeof(lk));
node=(*head);
printf("%d",node->data);
printf("x^%d",node->power);
node=node->next;
while(node!=NULL)
{
if(node->data > 0)
printf("+%d",node->data);
else
printf("%d",node->data);
if (node->power==0)
goto l1;
else
printf("x");
printf("^%d",node->power);
l1:
node=node->next;
}
}
//udf for addition of two polynomial
void add()
{
lk *temp1,*temp2,*temp,*node;
temp1=fnode;
temp2=snode;
while(temp1 || temp2)
{
temp=(lk *)malloc(sizeof(lk));
temp->next=NULL;
if(temp1->power==temp2->power)
{
temp->power=temp1->power;
temp->data=temp1->data + temp2->data;
temp1=temp1->next;
temp2=temp2->next;
}
else if(temp1->power>temp2->power)
{
temp->power=temp1->power;
temp->data=temp1->data;
temp1=temp1->next;
}
else
{
temp->power=temp2->power;
temp->data=temp2->data;
temp2=temp2->next;
}
if(start2==NULL)
start2=temp;
else
node->next=temp;
node=temp;
last=temp;
}//end of while loop
printf("\n 1st Polynomial equation is====>");
disp(&fnode);
printf("\n\n 2nd Polynomial equation is====>");
disp(&snode);
printf("\n\n After addition the equation is ====>");
disp(&start2);
}
//udf for addition of two polynomial
void sub()
{
lk *temp1,*temp2,*temp,*node,*start5=NULL;
temp1=fnode;
temp2=snode;
while(temp1 || temp2)
{
temp=(lk *)malloc(sizeof(lk ));
temp->next=NULL;
if(temp1->power==temp2->power)
{
temp->power=temp1->power;
temp->data=temp1->data - temp2->data;
temp1=temp1->next;
temp2=temp2->next;
}
else if(temp1->power>temp2->power)
{
temp->power=temp1->power;
temp->data=temp1->data;
temp1=temp1->next;
}
else
{
temp->power=temp2->power;
temp->data=temp2->data;
temp2=temp2->next;
}
if(start5==NULL)
start5=temp;
else
node->next=temp;
node=temp;
last=temp;
}//end of while loop
printf("\n 1st Polynomial equation is====>");
disp(&fnode);
printf("\n\n 2nd Polynomial equation is====>");
disp(&snode);
printf("\n\n After Subtraction the equation is ====>");
disp(&start5);
}
//mul
void mul()
{
int max=0,c=0;
lk *temp1,*temp2,*temp,*node,*start3=NULL,*start4=NULL;
lk *tmp1,*tmp2;
temp1=fnode;
while(temp1)
{
temp2=snode;
while(temp2)
{
temp=(lk *)malloc(sizeof(lk));
temp->next=NULL;
temp->data=temp1->data * temp2->data;
temp->power=temp1->power+temp2->power;
temp2=temp2->next;
if(max < temp->power)
max=temp->power;
if(start3==NULL)
start3=temp;
else
node->next=temp;
node=temp;
last=temp;
}
temp1=temp1->next;
}
tmp1=start3;
while(tmp1)
{
c=0;
tmp2=tmp1;
temp=(lk *)malloc(sizeof(lk));
temp->next=NULL;
temp->data=0;
while(tmp2)
{
if(max==tmp2->power)
{
c=1;
temp->power=tmp2->power;
temp->data =temp->data+ tmp2->data;
}
tmp2=tmp2->next;
}//end of inner loop
if(c==0)
{
temp->power=tmp1->power;
temp->data=tmp1->data;
}
if(start4==NULL)
start4=temp;
else
node->next=temp;
node=temp;
last=temp;
max--;
if (max<0)
break;
tmp1=tmp1->next;
}//end of while loop
printf("\n 1st Polynomial equation is====>");
disp(&fnode);
printf("\n\n 2nd Polynomial equation is====>");
disp(&snode);
printf("\n\n After Multiplication the equation is ====>");
disp(&start4);
}
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
Subscribe to:
Posts (Atom)