source file name: SumClient.java import java.net.*; import java.io.*; class SumClient { public static void main(String args[])throws Exception{ Socket s=new Socket(InetAddress.getLocalHost(),1234); DataInputStream din=new DataInputStream(s.getInputStream()); DataOutputStream dout=new DataOutputStream(s.g…
Read more6) Write a Java program that client sends number then server find and display factorial value of given number.
source file name: FactClient.java import java.net.*; import java.io.*; class FactClient { public static void main(String args[])throws Exception{ Socket s=new Socket("localhost",3333); DataInputStream din=new DataInputStream(s.getInputStream()); DataOutputStream dout=new DataOutputStream(s.get…
Read more20) Write a Java program that finds complex numbers sum,difference, product of x+iy complex number using different constructors.
source file name: ComplexDemo.java import java.io.*; class Complex { float x,y; public Complex() { x=y=0; } public Complex(float m) { x=y=m; } public Complex(float m, float n) { x=m; y=n; } public void disp() { System.out.println(x+"+i "+y); } public Complex sum(Complex p, Complex q) { Complex r = new Comp…
Read more19) Write a Java program that finds point lies in Rectangle and Largest Rectangle of two coordinates using constructor instance variable.
source file name: rectdemo.java import java.io.*; class rectangle { int x,y,len,bd; public rectangle() { x=y=0; len=bd=0; } public rectangle(int lenbd) { x=y=10; len=bd=lenbd; } public rectangle(int xc, int yc, int leng, int bdt) { x=xc; y=yc; len=x+10; bd=y+10; } void display() { System.out.println("x="+…
Read more18) Write a Java program that finds length and slope of two points using constructor instance variable.
source file name: ActionPoints.java import java.io.*; class Points { int x1,x2,y1,y2; public Points(int p,int q,int r,int s) { x1=p;y1=q;x2=r;y2=s; } public void disppoints() { System.out.println("x1: "+x1+" y1= "+y1); System.out.println("x2: "+x2+" y2= "+y2); } public void len…
Read more17) Write a Java program that finds length and slope of segment using constructor instance variable.
source file name: ActionPoint.java import java.io.*; class Point { int x,y; public Point(int p,int q) { x=p;y=q; } public Point() { x=0;y=0; } public void disppoint() { System.out.println("x: "+x+" y= "+y); } public void length(Point O,Point P) { double len; len=Math.sqrt((P.x-O.x)*(P.x-O.x)+(P.y…
Read more16)Write a Java program that finds distance between two points using constructor instance variable.
source fie name: Action.java import java.io.*; class ActionPoint { int x,y; public ActionPoint(int p,int q) { x=p;y=q; } public ActionPoint() { x=0;y=0; } public void disppoint() { System.out.println("x: "+x+" y= "+y); } public void length(ActionPoint O,ActionPoint P) { double len; len=Math.sqrt…
Read more